Repository navigation
Merge pull request #459 from hookdeck/dependabot/go_modules/github.co… #129
Workflow file for this run
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: | |
| push: | |
| tags: | |
| - "v*" | |
| jobs: | |
| # Gate: the release only proceeds if the acceptance suite passes on the tagged | |
| # commit. On a transient failure, use "Re-run failed jobs" — builds and the npm | |
| # publish only run once acceptance is green, so no re-tag is needed. | |
| acceptance: | |
| uses: ./.github/workflows/acceptance.yml | |
| secrets: inherit | |
| build-mac: | |
| needs: [acceptance] | |
| runs-on: macos-latest | |
| steps: | |
| - name: Code checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.26.6 | |
| - name: Run GoReleaser | |
| uses: goreleaser/goreleaser-action@v5 | |
| with: | |
| version: v2.12.1 | |
| args: release -f .goreleaser/mac.yml --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} | |
| build-linux: | |
| needs: [acceptance] | |
| runs-on: ubuntu-latest | |
| env: | |
| # https://goreleaser.com/customization/docker_manifest/ | |
| DOCKER_CLI_EXPERIMENTAL: "enabled" | |
| steps: | |
| - name: Code checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Docker Login | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Set up Docker QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.26.6 | |
| - name: Run GoReleaser | |
| uses: goreleaser/goreleaser-action@v5 | |
| with: | |
| version: v2.12.1 | |
| args: release -f .goreleaser/linux.yml --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} | |
| build-windows: | |
| needs: [acceptance] | |
| runs-on: windows-latest | |
| steps: | |
| - name: Code checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.26.6 | |
| - name: Run GoReleaser | |
| uses: goreleaser/goreleaser-action@v5 | |
| with: | |
| version: v2.12.1 | |
| args: release -f .goreleaser/windows.yml --clean | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} | |
| publish-npm: | |
| runs-on: ubuntu-latest | |
| needs: [build-windows, build-linux, build-mac] | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: write # For git operations | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.READ_WRITE_PAT }} | |
| fetch-depth: 0 | |
| - name: Determine release branch | |
| id: get_branch | |
| run: | | |
| BRANCHES=$(git branch -r --contains ${{ github.ref_name }} | sed 's/ *origin\///' | grep -v HEAD) | |
| if echo "$BRANCHES" | grep -q -w "main"; then | |
| RELEASE_BRANCH="main" | |
| elif echo "$BRANCHES" | grep -q -w "master"; then | |
| RELEASE_BRANCH="master" | |
| else | |
| RELEASE_BRANCH=$(echo "$BRANCHES" | head -n 1) | |
| fi | |
| echo "RELEASE_BRANCH=${RELEASE_BRANCH}" >> $GITHUB_OUTPUT | |
| echo "Determined release branch for commit: ${RELEASE_BRANCH}" | |
| - name: Checkout release branch | |
| run: git checkout ${{ steps.get_branch.outputs.RELEASE_BRANCH }} | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22.x" | |
| registry-url: "https://registry.npmjs.org" | |
| # npm@latest now requires Node >= 22.22 (it dropped Node 20 support), and | |
| # `npm publish --provenance` (OIDC) needs a recent npm, so this job runs on | |
| # Node 22.x rather than 20.x. | |
| - name: Upgrade npm to latest version | |
| run: npm install -g npm@latest | |
| - name: Get GitHub tag version | |
| id: tag-version | |
| run: | | |
| TAG_VERSION=${GITHUB_REF_NAME#v} | |
| echo Version: $TAG_VERSION | |
| echo "TAG_VERSION=$TAG_VERSION" >> $GITHUB_OUTPUT | |
| - name: Update package.json version | |
| uses: jossef/action-set-json-field@v2.1 | |
| with: | |
| file: package.json | |
| field: version | |
| value: ${{ steps.tag-version.outputs.TAG_VERSION }} | |
| - name: Commit package.json version | |
| uses: EndBug/add-and-commit@v9 | |
| with: | |
| default_author: github_actions | |
| message: "Update package.json version to ${{ steps.tag-version.outputs.TAG_VERSION }}" | |
| add: "package.json" | |
| - run: npm ci | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: 1.26.6 | |
| - name: Build npm binaries with GoReleaser | |
| uses: goreleaser/goreleaser-action@v5 | |
| with: | |
| version: v2.12.1 | |
| args: build -f .goreleaser/npm.yml --clean --skip validate | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Determine npm tag for pre-releases | |
| id: npm_tag | |
| run: | | |
| TAG_VERSION="${{ steps.tag-version.outputs.TAG_VERSION }}" | |
| NPM_TAG="latest" | |
| if [[ "$TAG_VERSION" == *-* ]]; then | |
| NPM_TAG=$(echo "$TAG_VERSION" | cut -d'-' -f2 | cut -d'.' -f1) | |
| fi | |
| echo "tag=${NPM_TAG}" >> $GITHUB_OUTPUT | |
| echo "npm tag: ${NPM_TAG}" | |
| - run: npm publish --provenance --tag ${{ steps.npm_tag.outputs.tag }} |