Release #31
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 | |
| # Run only after CI succeeds on main (avoids duplicating test/lint/coverage here). | |
| on: | |
| workflow_run: | |
| workflows: [CI] | |
| types: [completed] | |
| branches: [main] | |
| concurrency: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }} | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| permissions: | |
| contents: write | |
| id-token: write | |
| packages: write | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.workflow_run.head_sha }} | |
| fetch-depth: 0 | |
| - uses: pnpm/action-setup@v5 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| cache: pnpm | |
| registry-url: https://registry.npmjs.org | |
| scope: "@digital-science-dsl" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: | | |
| pnpm exec tsc -b --clean | |
| pnpm exec tsc -b | |
| - name: Create Release PR or Publish | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| version: pnpm run version | |
| publish: pnpm run release | |
| title: "chore: version packages" | |
| commit: "chore: version packages" | |
| createGithubReleases: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| LEFTHOOK: "0" | |
| # changesets sets published=true only when it publishes via a changeset file. | |
| # When changesets are already consumed on main, it falls back to publish:packages | |
| # without setting published — still tag if no version PR was opened. | |
| - name: Create v-prefixed git tag | |
| if: >- | |
| steps.changesets.outputs.published == 'true' || | |
| (steps.changesets.outcome == 'success' && steps.changesets.outputs.pullRequestNumber == '') | |
| run: | | |
| VERSION=$(jq -r '.version' apps/mcp/package.json) | |
| if git rev-parse "v$VERSION" >/dev/null 2>&1; then | |
| echo "Tag v$VERSION already exists, skipping" | |
| else | |
| git tag "v$VERSION" | |
| git push origin "v$VERSION" | |
| fi | |
| - name: Create GitHub Release | |
| if: >- | |
| steps.changesets.outputs.published == 'true' || | |
| (steps.changesets.outcome == 'success' && steps.changesets.outputs.pullRequestNumber == '') | |
| run: | | |
| VERSION=$(jq -r '.version' apps/mcp/package.json) | |
| if gh release view "v$VERSION" >/dev/null 2>&1; then | |
| echo "Release v$VERSION already exists, skipping" | |
| else | |
| gh release create "v$VERSION" \ | |
| --title "v$VERSION" \ | |
| --notes "See package CHANGELOGs for details." \ | |
| --verify-tag | |
| fi | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |