add job to setup release properties

This commit is contained in:
Joel Wetzell
2026-05-17 12:43:15 -05:00
parent 49227f9a82
commit 6a324a41b5
+39 -32
View File
@@ -10,8 +10,33 @@ permissions:
contents: write
jobs:
setup_release:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set_version.outputs.version }}
short_commit: ${{ steps.set_commit.outputs.short_commit }}
steps:
- name: checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: set environment variables
run: echo "SHOWBRIDGE_VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
- name: clean tag
if: startsWith(github.ref, 'refs/tags/v')
run: echo "SHOWBRIDGE_VERSION=${SHOWBRIDGE_VERSION#v}" >> $GITHUB_ENV
- name: set version
id: set_version
run: echo "version=${SHOWBRIDGE_VERSION}" >> $GITHUB_OUTPUT
- name: set commit
id: set_commit
run: echo "short_commit=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
linux_amd64:
runs-on: ubuntu-24.04
needs: setup_release
env:
SHOWBRIDGE_VERSION: ${{ needs.setup_release.outputs.version }}
SHORT_COMMIT: ${{ needs.setup_release.outputs.short_commit }}
steps:
- name: checkout
uses: actions/checkout@v6
@@ -23,13 +48,6 @@ jobs:
go-version-file: "go.mod"
- name: install alsa lib
run: sudo apt-get install -y libasound2-dev
- name: setup env variables
run: |
echo "SHOWBRIDGE_VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
echo "SHORT_COMMIT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: clean tag
if: startsWith(github.ref, 'refs/tags/v')
run: echo "SHOWBRIDGE_VERSION=${SHOWBRIDGE_VERSION#v}" >> $GITHUB_ENV
- name: build
run: |
CGO_ENABLED=1 go build -o showbridge -ldflags="-s -w -X main.version=${SHOWBRIDGE_VERSION}-${SHORT_COMMIT}" ./cmd/showbridge
@@ -43,6 +61,10 @@ jobs:
showbridge_*.tar.gz
linux_arm64:
runs-on: ubuntu-24.04-arm
needs: setup_release
env:
SHOWBRIDGE_VERSION: ${{ needs.setup_release.outputs.version }}
SHORT_COMMIT: ${{ needs.setup_release.outputs.short_commit }}
steps:
- name: checkout
uses: actions/checkout@v6
@@ -54,13 +76,6 @@ jobs:
go-version-file: "go.mod"
- name: install alsa lib
run: sudo apt-get install -y libasound2-dev
- name: setup env variables
run: |
echo "SHOWBRIDGE_VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
echo "SHORT_COMMIT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: clean tag
if: startsWith(github.ref, 'refs/tags/v')
run: echo "SHOWBRIDGE_VERSION=${SHOWBRIDGE_VERSION#v}" >> $GITHUB_ENV
- name: build
run: |
CGO_ENABLED=1 go build -o showbridge -ldflags="-s -w -X main.version=${SHOWBRIDGE_VERSION}-${SHORT_COMMIT}" ./cmd/showbridge
@@ -74,6 +89,10 @@ jobs:
showbridge_*.tar.gz
windows:
runs-on: ubuntu-latest
needs: setup_release
env:
SHOWBRIDGE_VERSION: ${{ needs.setup_release.outputs.version }}
SHORT_COMMIT: ${{ needs.setup_release.outputs.short_commit }}
steps:
- name: checkout
uses: actions/checkout@v6
@@ -87,13 +106,6 @@ jobs:
uses: mlugg/setup-zig@v2
with:
version: 0.16.0
- name: setup env variables
run: |
echo "SHOWBRIDGE_VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
echo "SHORT_COMMIT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: clean tag
if: startsWith(github.ref, 'refs/tags/v')
run: echo "SHOWBRIDGE_VERSION=${SHOWBRIDGE_VERSION#v}" >> $GITHUB_ENV
- name: build amd64
run: |
CGO_ENABLED=1 GOOS=windows GOARCH=amd64 CC="zig cc -target x86_64-windows-gnu" CXX="zig c++ -target x86_64-windows-gnu" go build -o showbridge -ldflags="-s -w -X main.version=${SHOWBRIDGE_VERSION}-${SHORT_COMMIT}" ./cmd/showbridge
@@ -102,7 +114,6 @@ jobs:
run: |
CGO_ENABLED=1 GOOS=windows GOARCH=arm64 CC="zig cc -target aarch64-windows-gnu" CXX="zig c++ -target aarch64-windows-gnu" go build -o showbridge -ldflags="-s -w -X main.version=${SHOWBRIDGE_VERSION}-${SHORT_COMMIT}" ./cmd/showbridge
zip showbridge_${SHOWBRIDGE_VERSION}_windows-arm64.zip showbridge
- name: upload windows artifacts
uses: actions/upload-artifact@v7
if: github.event_name == 'workflow_dispatch'
@@ -111,7 +122,11 @@ jobs:
path: |
showbridge_*.zip
macos:
runs-on: macos-latest
runs-on: macos-26
needs: setup_release
env:
SHOWBRIDGE_VERSION: ${{ needs.setup_release.outputs.version }}
SHORT_COMMIT: ${{ needs.setup_release.outputs.short_commit }}
steps:
- name: checkout
uses: actions/checkout@v6
@@ -125,22 +140,14 @@ jobs:
uses: mlugg/setup-zig@v2
with:
version: 0.16.0
- name: setup env variables
run: |
echo "SHOWBRIDGE_VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
echo "SHORT_COMMIT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: clean tag
if: startsWith(github.ref, 'refs/tags/v')
run: echo "SHOWBRIDGE_VERSION=${SHOWBRIDGE_VERSION#v}" >> $GITHUB_ENV
- name: build amd64
run: |
SDK_PATH=$(xcrun --show-sdk-path) CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 CC="clang -arch x86_64 -isysroot $SDK_PATH" CXX="clang++ -arch x86_64 -isysroot $SDK_PATH" go build -o showbridge -ldflags="-s -w -X main.version=${SHOWBRIDGE_VERSION}-${SHORT_COMMIT}" ./cmd/showbridge
tar -czf showbridge_${SHOWBRIDGE_VERSION}_macOS-amd64.tar.gz showbridge
- name: build arm64
run: |
SDK_PATH=$(xcrun --show-sdk-path) CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 CC="clang -arch arm64 -isysroot $SDK_PATH" CXX="clang++ -arch arm64 -isysroot $SDK_PATH" go build -o showbridge -ldflags="-s -w -X main.version=${SHOWBRIDGE_VERSION}-${SHORT_COMMIT}" ./cmd/showbridge
CGO_ENABLED=1 GOOS=darwin GOARCH=arm64 go build -o showbridge -ldflags="-s -w -X main.version=${SHOWBRIDGE_VERSION}-${SHORT_COMMIT}" ./cmd/showbridge
tar -czf showbridge_${SHOWBRIDGE_VERSION}_macOS-arm64.tar.gz showbridge
- name: upload macos artifacts
uses: actions/upload-artifact@v7
if: github.event_name == 'workflow_dispatch'