Release #13
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: | |
| workflow_dispatch: | |
| inputs: | |
| release_type: | |
| description: 'Release type' | |
| required: true | |
| default: 'alpha' | |
| type: choice | |
| options: | |
| - alpha | |
| - alpha-minor | |
| - alpha-major | |
| - release-minor | |
| - release-patch | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| id-token: write | |
| concurrency: | |
| group: release | |
| cancel-in-progress: false | |
| jobs: | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.14 | |
| cache: npm | |
| - run: npm ci | |
| - run: npm run generate | |
| - run: npm run lint | |
| - run: npm run typecheck | |
| - run: npm test | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| persist-credentials: false | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.14 | |
| cache: npm | |
| registry-url: https://registry.npmjs.org | |
| - run: npm install -g npm@latest | |
| - run: npm ci | |
| - run: npm run build | |
| - name: Remove orphaned release tags | |
| run: | | |
| for TAG in $(git tag -l 'v[0-9]*'); do | |
| if ! git merge-base --is-ancestor "$TAG" HEAD 2>/dev/null; then | |
| echo "Tag $TAG points to a commit not in current branch — removing" | |
| git push origin ":refs/tags/$TAG" || true | |
| git tag -d "$TAG" || true | |
| fi | |
| done | |
| - name: Semantic Release | |
| id: semantic | |
| uses: cycjimmy/semantic-release-action@v6 | |
| with: | |
| semantic_version: 24 | |
| extra_plugins: | | |
| @semantic-release/changelog | |
| @semantic-release/git | |
| branches: > | |
| [${{ startsWith(inputs.release_type, 'release') | |
| && '"main"' | |
| || '{ "name": "main", "prerelease": "alpha", "channel": "alpha" }' }}] | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to npm (trusted publishing) | |
| if: steps.semantic.outputs.new_release_published == 'true' | |
| run: npm publish --provenance --access public --ignore-scripts |