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
27 changes: 21 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Tag to release (e.g. v0.2.0)'
required: true
type: string
dry_run:
description: 'Skip publishing (dry run)'
required: false
type: boolean
default: true

jobs:
release:
Expand All @@ -18,7 +29,7 @@ jobs:
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@41dfa10bef8ca8f7c4c7cec63b269ccb8a9156b9 # v6
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 issue (security): Switching from a pinned SHA to a floating action tag weakens supply-chain security.

Using @v6 means any future (including breaking or compromised) releases of actions/setup-go will be used automatically. Please pin to a specific commit SHA (and optionally note the version in a comment) to keep builds deterministic and limit supply-chain risk. A tool like Dependabot can then update the pinned SHA in a controlled way.

uses: actions/setup-go@v6
with:
go-version-file: go.mod
cache-dependency-path: go.sum
Expand All @@ -30,23 +41,27 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Resolve tag
id: resolve_tag
run: echo "tag=${{ github.event.inputs.tag || github.ref_name }}" >> "$GITHUB_OUTPUT"
- name: Verify changie release notes exist
run: |
if [ ! -f "changes/${{ github.ref_name }}.md" ]; then
echo "::error::Changie fragment changes/${{ github.ref_name }}.md not found."
echo "::error::Run 'changie batch ${{ github.ref_name }}' and 'changie merge' before pushing the tag."
if [ ! -f "changes/${{ steps.resolve_tag.outputs.tag }}.md" ]; then
echo "::error::Changie fragment changes/${{ steps.resolve_tag.outputs.tag }}.md not found."
echo "::error::Run 'changie batch ${{ steps.resolve_tag.outputs.tag }}' and 'changie merge' before pushing the tag."
exit 1
fi
- name: Execute GoReleaser
uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # goreleaser-action v7
with:
distribution: goreleaser
version: "~> v2"
args: release --clean --release-notes changes/${{ github.ref_name }}.md
args: release --clean --release-notes changes/${{ steps.resolve_tag.outputs.tag }}.md ${{ github.event.inputs.dry_run == 'true' && '--skip-publish' || '' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload assets
uses: actions/upload-artifact@5d5df5e032fcb57d3c9d9901e9b8f8b2b7d8051a # v7
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 issue (security): Using a version tag instead of a commit SHA for upload-artifact introduces non-determinism and security risk.

As with setup-go, the floating @v4 tag can change over time, making builds non-reproducible and increasing supply-chain risk. Please pin actions/upload-artifact to the specific commit SHA for the intended v4 release instead of the major tag.

if: ${{ github.event.inputs.dry_run != 'true' }}
uses: actions/upload-artifact@v4
with:
name: devcloud
path: dist/*
Loading