Merge pull request #456 from CollinsC1O/empty-state #12
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 | |
| # Triggered automatically when commits land on main, and can also be | |
| # kicked off manually (e.g. to cut a hotfix release on-demand). | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: 'Run in dry-run mode (no tags or releases created)' | |
| required: false | |
| default: 'false' | |
| type: choice | |
| options: | |
| - 'false' | |
| - 'true' | |
| # Only one release job should run at a time to avoid tag conflicts. | |
| concurrency: | |
| group: release | |
| cancel-in-progress: false | |
| jobs: | |
| release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| # semantic-release needs write access to push tags and create releases. | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| # Full history is required so semantic-release can read all commits | |
| # and determine the next version correctly. | |
| fetch-depth: 0 | |
| # Use a token with write access so the pushed tag triggers downstream | |
| # workflows (the default GITHUB_TOKEN cannot re-trigger workflows). | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # ── Node setup ────────────────────────────────────────────────────────── | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| # Cache semantic-release and its plugins so repeat runs are fast. | |
| - name: Cache semantic-release dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-semantic-release-${{ hashFiles('.releaserc.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-semantic-release- | |
| # ── Install release tooling ────────────────────────────────────────────── | |
| # We install globally so no package.json change is needed in the repo root. | |
| - name: Install semantic-release | |
| run: | | |
| npm install -g \ | |
| semantic-release@24 \ | |
| @semantic-release/changelog@6 \ | |
| @semantic-release/git@10 \ | |
| @semantic-release/github@10 \ | |
| @semantic-release/exec@6 \ | |
| conventional-changelog-conventionalcommits@8 | |
| # ── Version bump: dashboard ────────────────────────────────────────────── | |
| # The dashboard package.json version is kept in sync via the exec plugin | |
| # (see .releaserc.json prepareCmd). We pre-install deps here so `npm version` | |
| # is available and the package-lock doesn't get regenerated unnecessarily. | |
| - name: Install dashboard dependencies (for version bump) | |
| working-directory: dashboard | |
| run: npm ci | |
| - name: Install listener dependencies (for version bump) | |
| working-directory: listener | |
| run: npm ci --ignore-scripts | |
| # ── Run semantic-release ───────────────────────────────────────────────── | |
| - name: Run semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| DRY_RUN: ${{ github.event.inputs.dry_run || 'false' }} | |
| run: | | |
| if [ "$DRY_RUN" = "true" ]; then | |
| npx semantic-release --dry-run | |
| else | |
| npx semantic-release | |
| fi | |
| # ── Post-release summary ───────────────────────────────────────────────── | |
| - name: Print release summary | |
| if: always() | |
| run: | | |
| echo "## Release workflow complete" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then | |
| echo "⚠️ Ran in **dry-run** mode — no tag or release was created." >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "✅ Check the [Releases page](https://github.com/${{ github.repository }}/releases) for the latest release." >> $GITHUB_STEP_SUMMARY | |
| fi |