Skip to content

build: inject version from Git tag via ldflags #7

build: inject version from Git tag via ldflags

build: inject version from Git tag via ldflags #7

Workflow file for this run

name: Cut Release
on:
push:
tags:
- 'v*' # Triggers strictly when you push a tag like v0.3.0 or v0.3.0-rc1
permissions:
contents: write # Required to create the release and upload assets
jobs:
build-and-release:
name: Build and Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required to accurately auto-generate the changelog
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Compile AMD64 (x86_64) Binary
run: |
echo "==> Building native (amd64) binary via Makefile..."
make build
mv bin/shiftlaunch bin/shiftlaunch-linux-amd64
echo "==> Compressing amd64 artifact..."
tar -czvf shiftlaunch-linux-amd64.tar.gz -C bin shiftlaunch-linux-amd64
- name: Compile PPC64LE Binary
run: |
echo "==> Cross-compiling ppc64le binary via Makefile..."
make build-ppc64le
echo "==> Compressing ppc64le artifact..."
tar -czvf shiftlaunch-linux-ppc64le.tar.gz -C bin shiftlaunch-linux-ppc64le
- name: Determine if Pre-release
id: check-prerelease
run: |
# If the tag contains a hyphen (e.g., v0.3.0-rc1), mark as pre-release
if [[ "${{ github.ref_name }}" == *-* ]]; then
echo "Detected pre-release tag format."
echo "is_prerelease=true" >> $GITHUB_OUTPUT
else
echo "Detected stable release tag format."
echo "is_prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Create GitHub Release & Upload Artifacts
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true # GitHub will write the changelog for you!
prerelease: ${{ steps.check-prerelease.outputs.is_prerelease == 'true' }}
files: |
shiftlaunch-linux-amd64.tar.gz
shiftlaunch-linux-ppc64le.tar.gz