Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 31 additions & 15 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
tag:
description: Source tag to release
required: true

permissions:
contents: read
Expand All @@ -18,18 +23,25 @@ jobs:
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Empty on a tag push, where the triggering ref is already the tag.
# Dispatched runs are privileged, so the input can only name a tag,
# never a branch or a pull request.
ref: ${{ inputs.tag && format('refs/tags/{0}', inputs.tag) || '' }}
fetch-depth: 0
Comment thread
coderabbitai[bot] marked this conversation as resolved.
persist-credentials: false
- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
with:
go-version-file: go.mod
- uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- uses: docker/login-action@371161bbe7024a29a25c5e19bfcbc0804fe9ad2c # v4.5.2
- if: github.event_name == 'push'
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- if: github.event_name == 'push'
uses: docker/login-action@371161bbe7024a29a25c5e19bfcbc0804fe9ad2c # v4.5.2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Generate GitHub App token
if: github.event_name == 'push'
id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
Expand All @@ -43,29 +55,38 @@ jobs:
- uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3
with:
version: "~> v2"
args: release --clean
# A dispatched run only needs dist/ populated so the npm packages can
# be assembled from it, so it rebuilds the tag's binaries and archives
# nothing. Those binaries won't be byte-identical to the ones already
# released - go.mod asks for Go 1.26, so setup-go resolves whatever
# patch is current - which is why nothing else is republished here.
args: ${{ github.event_name == 'workflow_dispatch' && 'build --clean' || 'release --clean' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
# Attests every file listed in the checksum file.
- uses: actions/attest@508db95dd578ae2727ebd6217d5ba78e4fbda05d # v4.2.1
- if: github.event_name == 'push'
uses: actions/attest@508db95dd578ae2727ebd6217d5ba78e4fbda05d # v4.2.1
with:
subject-checksums: ./dist/checksums.txt
- uses: actions/attest@508db95dd578ae2727ebd6217d5ba78e4fbda05d # v4.2.1
- if: github.event_name == 'push'
uses: actions/attest@508db95dd578ae2727ebd6217d5ba78e4fbda05d # v4.2.1
with:
subject-checksums: ./dist/digests.txt

- uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version: 24 # npm >= 11.5.1 required for OIDC trusted publishing
# TODO: switch to goreleaser-npm-publisher-action once https://github.com/evg4b/goreleaser-npm-publisher/pull/26 is released
# Prebuilt dist committed on the fork branch (5e09f1e + dist/, built and
# smoke-tested locally). Deliberately no yarn install/build here: this job
# holds id-token: write, so third-party install scripts must not run in it.
# Prebuilt dist committed on the fork branch
- name: Fetch goreleaser-npm-publisher
run: |
git clone https://github.com/khvn26/goreleaser-npm-publisher "$RUNNER_TEMP/gnp"
git -C "$RUNNER_TEMP/gnp" checkout ad16d393106b23b6289d0569beefb8e9b3bd3159
- name: Install goreleaser-npm-publisher runtime dependencies
working-directory: ${{ runner.temp }}/gnp
# set --mode=skip-build to block third-party install/postinstall scripts
run: corepack yarn install --immutable --mode=skip-build
- name: Publish npm packages
run: >-
node "$RUNNER_TEMP/gnp/dist/cli.cjs" publish
Expand All @@ -78,16 +99,10 @@ jobs:
--keywords flagsmith feature-flags cli
--files README.md LICENSE

# During public beta the newest beta is what people
# should land on, so clear it.
- if: contains(github.ref_name, '-beta')
run: gh release edit "$GITHUB_REF_NAME" --prerelease=false --latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

install-script:
name: install.sh (${{ matrix.os }})
needs: goreleaser
if: github.event_name == 'push'
strategy:
fail-fast: false
matrix:
Expand All @@ -103,6 +118,7 @@ jobs:
install-script-windows:
name: install.ps1
needs: goreleaser
if: github.event_name == 'push'
runs-on: windows-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand Down