Release #11
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: | |
| version: | |
| description: 'New semver version (e.g., 1.2.3)' | |
| required: true | |
| type: string | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Update package.json version | |
| run: npm version ${{ github.event.inputs.version }} --no-git-tag-version | |
| - name: Build package | |
| run: npm run build | |
| - name: Configure Git | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| - name: Commit and push changes | |
| run: | | |
| git add package.json package-lock.json | |
| git commit -m "chore: release v${{ github.event.inputs.version }}" | |
| git push origin main | |
| - name: Create Git tag | |
| run: | | |
| git tag v${{ github.event.inputs.version }} | |
| git push origin v${{ github.event.inputs.version }} | |
| - name: Publish to npm | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create GitHub Release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ github.event.inputs.version }} | |
| release_name: Release v${{ github.event.inputs.version }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true |