chore(deps)(deps): bump actions/upload-artifact from 4 to 6 (#354) #102
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: [main] | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| permissions: | |
| contents: write # For creating tags and pushing commits | |
| issues: write # For creating GitHub releases | |
| pull-requests: write # For release notes | |
| id-token: write # For npm provenance generation | |
| jobs: | |
| release: | |
| name: Release Packages | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| environment: npm | |
| # Don't run on version bump commits to avoid infinite loop | |
| # Branch protection should require CI to pass before merge | |
| if: | | |
| !startsWith(github.event.head_commit.message, 'chore(release):') && | |
| github.event.head_commit.author.username != 'github-actions[bot]' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| with: | |
| # Fetch all history and tags for lerna to detect changes | |
| fetch-depth: 0 | |
| # Use a token that can trigger workflows | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js from .nvmrc | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'npm' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build packages | |
| run: npm run build | |
| - name: Run tests | |
| run: npm run test:ci | |
| - name: Version packages | |
| id: version | |
| run: | | |
| # Capture current tags before versioning | |
| TAGS_BEFORE=$(git tag | wc -l) | |
| # Run lerna version (exits 0 even if no changes) | |
| npx lerna version --yes --no-private --sync-workspace-lock || EXIT_CODE=$? | |
| # Check if any new tags were created | |
| TAGS_AFTER=$(git tag | wc -l) | |
| TAGS_CREATED=$((TAGS_AFTER - TAGS_BEFORE)) | |
| if [ $TAGS_CREATED -eq 0 ]; then | |
| echo "has_changes=false" >> $GITHUB_OUTPUT | |
| echo "ℹ️ No packages to release - no changes detected" | |
| else | |
| echo "has_changes=true" >> $GITHUB_OUTPUT | |
| echo "✅ Created $TAGS_CREATED version tag(s)" | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to npm | |
| if: steps.version.outputs.has_changes == 'true' | |
| run: npx lerna publish from-git --yes --no-private | |
| - name: No changes detected | |
| if: steps.version.outputs.has_changes == 'false' | |
| run: | | |
| echo "ℹ️ No packages have changes that warrant a release." | |
| echo "" | |
| echo "This can happen when:" | |
| echo " - Only ignored files changed (tests, docs, config)" | |
| echo " - Commits don't match conventional commit format" | |
| echo " - Recent release already published the changes" | |
| echo "" | |
| echo "See lerna.json ignoreChanges for patterns that skip releases." | |
| - name: Release summary | |
| if: steps.version.outputs.has_changes == 'true' | |
| run: | | |
| echo "## 🚀 Production Release Published" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "Packages have been published to npm with the \`latest\` dist-tag." >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "See the [Releases](https://github.com/${{ github.repository }}/releases) page for details." >> $GITHUB_STEP_SUMMARY |