Release #8
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: | |
| bump: | |
| description: Semver bump to apply over the latest release | |
| type: choice | |
| default: patch | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| permissions: | |
| contents: write | |
| actions: write | |
| concurrency: | |
| group: release | |
| cancel-in-progress: false | |
| jobs: | |
| release: | |
| name: Cut release (${{ inputs.bump }}) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24.x | |
| - name: Compute next version | |
| id: version | |
| run: | | |
| latest_tag="$(git tag -l 'v*' --sort=-v:refname | head -n1 | sed 's/^v//')" | |
| npm_latest="$(npm view @patchstack/connect version 2>/dev/null || echo 0.0.0)" | |
| current="$(npx --yes semver "${latest_tag:-0.0.0}" "$npm_latest" | tail -n1)" | |
| next="$(npx --yes semver -i "${{ inputs.bump }}" "$current")" | |
| echo "Latest git tag: ${latest_tag:-none}" | |
| echo "npm latest: $npm_latest" | |
| echo "Bumping from: $current" | |
| echo "Next version: $next (bump: ${{ inputs.bump }})" | |
| if git ls-remote --tags origin "refs/tags/v$next" | grep -q .; then | |
| echo "::error::Tag v$next already exists on origin." | |
| exit 1 | |
| fi | |
| echo "next=$next" >> "$GITHUB_OUTPUT" | |
| - name: Create release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh release create "v${{ steps.version.outputs.next }}" \ | |
| --target "${{ github.sha }}" \ | |
| --title "v${{ steps.version.outputs.next }}" \ | |
| --generate-notes | |
| - name: Trigger publish | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh workflow run publish.yml -f version="${{ steps.version.outputs.next }}" |