Create tag #7
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
| --- | |
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
| name: Create tag | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| determine-tag-version: | |
| name: Determine tag version | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| outputs: | |
| tag_version: ${{ steps.git-cliff.outputs.tag_version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Install git-cliff | |
| uses: taiki-e/install-action@25435dc8dd3baed7417e0c96d3fe89013a5b2e09 # v2.81.3 | |
| with: | |
| tool: git-cliff | |
| - name: Get tag version | |
| id: git-cliff | |
| env: | |
| # In order to avoid hitting the GitHub API rate limit | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| tag_version=$(git-cliff -c .github/cliff.toml --bumped-version --unreleased) | |
| echo "Next tag version is ${tag_version}" | |
| echo "tag_version=${tag_version}" >> "$GITHUB_OUTPUT" | |
| create-tag: | |
| name: Create tag | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| needs: determine-tag-version | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG_VERSION: ${{ needs.determine-tag-version.outputs.tag_version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| ssh-key: '${{ secrets.COMMIT_KEY }}' | |
| - name: Pnpm Setup | |
| uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version-file: 'package.json' | |
| # For workflows with elevated privileges we recommend disabling automatic caching. | |
| # https://github.com/actions/setup-node | |
| package-manager-cache: false | |
| - name: Configure git | |
| run: | | |
| git config --global user.name "${{ github.actor }}" | |
| git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
| - name: Bump package.json | |
| run: npm version ${TAG_VERSION} --no-commit-hooks --no-git-tag-version | |
| - name: Commit updated files | |
| run: | | |
| git add package.json | |
| git commit -m "chore(release): prepare ${TAG_VERSION}" | |
| git push | |
| - name: Create git tag | |
| run: | | |
| git tag ${TAG_VERSION} | |
| git push origin ${TAG_VERSION} |