Skip to content
Closed
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
20 changes: 17 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ on:
tags:
- "v*"
workflow_dispatch:
inputs:
tag:
description: "Existing tag to publish (e.g. v0.2.0). Leave empty for a non-release build from this ref."
required: false
type: string

permissions:
contents: write
Expand All @@ -17,6 +22,7 @@ jobs:
uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0
with:
fetch-depth: 0
ref: ${{ inputs.tag || github.ref }}

- name: Setup Node
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
Expand Down Expand Up @@ -65,11 +71,18 @@ jobs:

- name: Resolve version
id: version
env:
INPUT_TAG: ${{ inputs.tag }}
run: |
if [[ "${GITHUB_REF_TYPE}" == "tag" ]]; then
echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
echo "release_tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
elif [[ -n "${INPUT_TAG}" ]]; then
echo "version=${INPUT_TAG#v}" >> "$GITHUB_OUTPUT"
echo "release_tag=${INPUT_TAG}" >> "$GITHUB_OUTPUT"
else
echo "version=0.0.0-dev.${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"
echo "release_tag=" >> "$GITHUB_OUTPUT"
fi

- name: Build binaries
Expand Down Expand Up @@ -99,13 +112,14 @@ jobs:
retention-days: 14

- name: Upload release assets
if: startsWith(github.ref, 'refs/tags/v')
if: steps.version.outputs.release_tag != ''
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_TAG: ${{ steps.version.outputs.release_tag }}
run: |
set -euo pipefail
gh release create "${GITHUB_REF_NAME}" \
--title "${GITHUB_REF_NAME}" \
gh release create "${RELEASE_TAG}" \
--title "${RELEASE_TAG}" \
--generate-notes \
dist/binaries/*.tar.gz \
dist/binaries/*.zip \
Expand Down