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: 45 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-beta-[0-9]+"
workflow_dispatch:
inputs:
tag_name:
description: "Release tag name (e.g. v1.2.3 or v1.2.3-beta-1)"
required: true
type: string

jobs:
release-draft:
Expand All @@ -28,6 +34,30 @@
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

- name: Determine and validate tag
id: resolve-tag
env:
INPUT_TAG_NAME: ${{ inputs.tag_name }}
EVENT_NAME: ${{ github.event_name }}
run: |
if [ "$EVENT_NAME" = "workflow_dispatch" ]; then
TAG="$INPUT_TAG_NAME"
if ! echo "$TAG" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+(-beta-[0-9]+)?$'; then
echo "Error: Tag '$TAG' does not match expected format (e.g. v1.2.3 or v1.2.3-beta-1)"
exit 1
fi
if git ls-remote --exit-code --tags origin "refs/tags/$TAG" >/dev/null 2>&1; then
echo "Error: Tag '$TAG' already exists"
exit 1
fi
else
TAG="${GITHUB_REF_NAME}"
fi
echo "tag_name=$TAG" >> "$GITHUB_OUTPUT"
echo "version=${TAG#v}" >> "$GITHUB_OUTPUT"

- name: Setup Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0
Expand All @@ -37,7 +67,9 @@
cache-dependency-path: "go.sum"

- name: Update VERSION file
run: echo "${GITHUB_REF_NAME#v}" > VERSION
env:
RESOLVED_VERSION: ${{ steps.resolve-tag.outputs.version }}
run: echo "$RESOLVED_VERSION" > VERSION

- name: Cache frontend build
id: cache-frontend-build
Expand Down Expand Up @@ -108,8 +140,20 @@
- name: Build Binaries
run: make build-go-binaries

- name: Push release tag
if: github.event_name == 'workflow_dispatch'
env:
RESOLVED_TAG: ${{ steps.resolve-tag.outputs.tag_name }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag "$RESOLVED_TAG"
git push origin "$RESOLVED_TAG"

- name: Create Release
uses: softprops/action-gh-release@3d0d9888cb7fd7b750713d6e236d1fcb99157228 # v3.0.2

Check notice on line 154 in .github/workflows/release.yaml

View workflow job for this annotation

GitHub Actions / zizmor-output

superfluous-actions

release.yaml:154: action functionality is already included by the runner: use `gh release` in a script step
with:
tag_name: ${{ steps.resolve-tag.outputs.tag_name }}
draft: true
generate_release_notes: true
files: bin/*
Loading