Skip to content
Merged
Show file tree
Hide file tree
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
65 changes: 53 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@ on:
- 'main'

jobs:
release:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0 # needed to make sure we get all tags
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version: '1.24'
Expand All @@ -25,13 +23,61 @@ jobs:

- name: build
run: |
mkdir -p dist
GOOS=linux GOARCH=amd64 go build -buildvcs=false -o ./dist/commit-headless-linux-amd64 .
GOOS=linux GOARCH=arm64 go build -buildvcs=false -o ./dist/commit-headless-linux-arm64 .

# TODO: Not sure how to determine the current os/arch to select one of the above binaries
# so we're just going to build another one
go build -buildvcs=false -o ./dist/commit-headless .
./dist/commit-headless version | awk '{print $3}' > ./dist/VERSION.txt
- name: upload artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: binaries
path: dist/

verify-binaries:
needs: build
runs-on: ${{ matrix.runner }}

strategy:
matrix:
include:
- runner: ubuntu-latest
binary: commit-headless-linux-amd64
- runner: ubuntu-24.04-arm
binary: commit-headless-linux-arm64

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: download artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: binaries
path: action-template/dist/

- name: verify binary
uses: ./action-template
with:
print-version: true

release:
needs: verify-binaries
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0 # needed to make sure we get all tags

- name: download artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
name: binaries
path: dist/

- name: get version
run: |
chmod +x ./dist/commit-headless-linux-amd64
./dist/commit-headless-linux-amd64 version | awk '{print $3}' > ./dist/VERSION.txt
echo "Current version: $(cat ./dist/VERSION.txt)"

- name: create action branch commit
Expand Down Expand Up @@ -74,17 +120,12 @@ jobs:
--message="action: ${subject}" \
--allow-empty # sometimes we have nothing to change, so this ensures we can still commit

REF=$(git rev-parse HEAD)
echo "sha=${REF}" >> $GITHUB_OUTPUT
echo "Created commit ${REF}"

- name: push commits
id: push-commits
uses: ./ # use the action defined in the action branch
with:
branch: action
command: push
commits: ${{ steps.create-commit.outputs.sha }}

- name: check release tag
id: check-tag
Expand Down
Loading
Loading