From b209dea7a2c6041c87dbb7386941a3ce45caa13a Mon Sep 17 00:00:00 2001 From: Nathan Nutter Date: Mon, 2 Nov 2026 16:13:16 -0600 Subject: [PATCH 1/3] Trigger the tap update from the version tag A release that `GITHUB_TOKEN` creates does not start a new workflow run, so `release: published` never fires for a release that the repository makes itself. Push a `v*` tag to start the tap update instead. Read the tag from `github.ref_name` when the event carries no release object. --- .github/workflows/update-tap.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-tap.yaml b/.github/workflows/update-tap.yaml index 7e67895..c647217 100644 --- a/.github/workflows/update-tap.yaml +++ b/.github/workflows/update-tap.yaml @@ -1,5 +1,7 @@ name: Update Tap on: + push: + tags: ["v*"] release: types: [published] workflow_dispatch: @@ -26,8 +28,18 @@ jobs: env: EVENT_TAG: ${{ github.event.release.tag_name }} INPUT_TAG: ${{ inputs.tag }} + REF_TAG: ${{ github.ref_name }} + REF_TYPE: ${{ github.ref_type }} run: | - tag="${EVENT_TAG:-$INPUT_TAG}" + if [[ -n "$EVENT_TAG" ]]; then + tag="$EVENT_TAG" + elif [[ -n "$INPUT_TAG" ]]; then + tag="$INPUT_TAG" + elif [[ "$REF_TYPE" == "tag" ]]; then + tag="$REF_TAG" + else + tag="" + fi if [[ -z "$tag" ]]; then echo "A release tag is required." >&2 exit 1 From d94faf085a96f0e6bb7adf9cda92f74773df368e Mon Sep 17 00:00:00 2001 From: Nathan Nutter Date: Mon, 2 Nov 2026 16:13:29 -0600 Subject: [PATCH 2/3] Release on a version tag with generated notes The maintainer now pushes a `v*` tag and the release makes itself. The notes come from the commits since the last tag, so no maintainer edits a notes file by hand. The release step skips a tag that already has a release, so a re-run changes nothing. --- .github/workflows/release.yaml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..9c016d1 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,29 @@ +name: Release +on: + push: + tags: ["v*"] +permissions: + contents: write +concurrency: + group: release + cancel-in-progress: false +jobs: + release: + runs-on: ubuntu-26.04 + timeout-minutes: 10 + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.ref_name }} + steps: + - name: Check out repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + persist-credentials: false + - name: Create the release + run: | + if gh release view "$TAG" >/dev/null 2>&1; then + echo "The release $TAG already exists." + exit 0 + fi + gh release create "$TAG" --verify-tag --generate-notes --title "$TAG" From e0e4b393aa24838b31b8b5dbb49ee723dca3d850 Mon Sep 17 00:00:00 2001 From: Nathan Nutter Date: Mon, 2 Nov 2026 16:15:11 -0600 Subject: [PATCH 3/3] Attach binaries for four platforms to the release The release now carries prebuilt archives, so a person does not need a Go toolchain to install roam. A release that has no assets must not appear in the public list, so the job creates a draft and fills it before it publishes. A re-run repairs a failed upload, and it does not publish a release twice. --- .github/workflows/release.yaml | 68 ++++++++++++++++++++++++++++++---- 1 file changed, 60 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9c016d1..788b2e4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -8,11 +8,19 @@ concurrency: group: release cancel-in-progress: false jobs: - release: + build: runs-on: ubuntu-26.04 - timeout-minutes: 10 + timeout-minutes: 20 + strategy: + fail-fast: false + matrix: + platform: + - {os: linux, arch: arm64} + - {os: linux, arch: amd64} + - {os: darwin, arch: arm64} + - {os: darwin, arch: amd64} env: - GH_TOKEN: ${{ github.token }} + BINARY: roam TAG: ${{ github.ref_name }} steps: - name: Check out repository @@ -20,10 +28,54 @@ jobs: with: fetch-depth: 0 persist-credentials: false - - name: Create the release + - name: Install mise + uses: jdx/mise-action@6612f0ef07ed2a736cd1e00a94a065522dd41195 # v5.2.5 + with: + version: 2026.10.25 + - name: Build the archive + env: + GOOS: ${{ matrix.platform.os }} + GOARCH: ${{ matrix.platform.arch }} + run: | + name="${BINARY}_${TAG}_${GOOS}_${GOARCH}" + CGO_ENABLED=0 go build -trimpath -ldflags "-s -w -X main.version=${TAG}" -o "$name" . + tar -czf "${name}.tar.gz" "$name" + - name: Upload the archive + uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: ${{ matrix.platform.os }}-${{ matrix.platform.arch }} + path: ${{ env.BINARY }}_${{ env.TAG }}_${{ matrix.platform.os }}_${{ matrix.platform.arch }}.tar.gz + if-no-files-found: error + publish: + needs: build + runs-on: ubuntu-26.04 + timeout-minutes: 10 + env: + GH_REPO: ${{ github.repository }} + GH_TOKEN: ${{ github.token }} + TAG: ${{ github.ref_name }} + steps: + - name: Download the archives + uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + path: dist + merge-multiple: true + - name: Make the checksums + run: cd dist && sha256sum -- *.tar.gz > checksums.txt + - name: Read the release state + id: state run: | - if gh release view "$TAG" >/dev/null 2>&1; then - echo "The release $TAG already exists." - exit 0 + if state="$(gh release view "$TAG" --json isDraft --jq '.isDraft' 2>/dev/null)"; then + if [[ "$state" == "true" ]]; then state=draft; else state=published; fi + else + state=none fi - gh release create "$TAG" --verify-tag --generate-notes --title "$TAG" + echo "state=$state" >> "$GITHUB_OUTPUT" + - name: Create a draft release + if: steps.state.outputs.state == 'none' + run: gh release create "$TAG" --verify-tag --draft --generate-notes --title "$TAG" + - name: Upload the assets + run: gh release upload "$TAG" dist/* --clobber + - name: Publish the release + if: steps.state.outputs.state != 'published' + run: gh release edit "$TAG" --draft=false --latest