Skip to content

docs: add comprehensive Portagent documentation #48

docs: add comprehensive Portagent documentation

docs: add comprehensive Portagent documentation #48

Workflow file for this run

name: Changesets
on:
push:
branches:
- main
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
id-token: write # For npm provenance
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Setup Node.js (for npm publish)
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
- name: Install Dependencies
run: bun install --frozen-lockfile
- name: Build Packages
run: bun run build
- name: Replace workspace protocol
run: |
# Get version from types package (all packages use same version via fixed mode)
VERSION=$(jq -r '.version' packages/types/package.json)
echo "Replacing workspace:* with ^${VERSION}"
# Replace workspace:* in all package.json files
find packages apps -name "package.json" -type f -exec sed -i 's/"workspace:\*"/"^'"${VERSION}"'"/g' {} \;
# Verify no workspace:* remains
if grep -r '"workspace:' packages/ apps/ --include="package.json" 2>/dev/null; then
echo "ERROR: workspace: protocol still found!"
exit 1
fi
echo "✅ All workspace:* replaced with ^${VERSION}"
- name: Create Release Pull Request or Publish
id: changesets
uses: changesets/action@v1
with:
version: bun run version
publish: bun run release
title: "chore: version packages"
commit: "chore: version packages"
createGithubReleases: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create Unified Release
if: steps.changesets.outputs.published == 'true'
id: release
run: |
# Get version from types package (all packages use same version via fixed mode)
VERSION=$(jq -r '.version' packages/types/package.json)
TAG="v${VERSION}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
# Check if tag already exists
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists, skipping release creation"
echo "created=false" >> $GITHUB_OUTPUT
exit 0
fi
# Create tag
git tag "$TAG"
git push origin "$TAG"
# Get changelog from published packages
PACKAGES='${{ steps.changesets.outputs.publishedPackages }}'
BODY="## Published Packages\n\n"
BODY+=$(echo "$PACKAGES" | jq -r '.[] | "- \(.name)@\(.version)"')
# Create GitHub release
gh release create "$TAG" \
--title "Release $TAG" \
--notes "$BODY"
echo "Created release $TAG"
echo "created=true" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Summary
if: steps.changesets.outputs.published == 'true'
run: |
VERSION=$(jq -r '.version' packages/types/package.json)
echo "## ✅ Packages Published" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Version:** v${VERSION}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Published packages:" >> $GITHUB_STEP_SUMMARY
echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r '.[] | "- `\(.name)@\(.version)`"' >> $GITHUB_STEP_SUMMARY
outputs:
published: ${{ steps.changesets.outputs.published }}
version: ${{ steps.release.outputs.version }}
# Build Docker images after successful publish
docker:
name: Build Docker
needs: release
if: needs.release.outputs.published == 'true'
uses: ./.github/workflows/post.yml
with:
version: ${{ needs.release.outputs.version }}
secrets: inherit