mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-09-12 00:19:27 +00:00
start working on getting rid of gorelease and full cross platform builds
This commit is contained in:
@@ -4,12 +4,13 @@ on:
|
|||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
goreleaser:
|
linux:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: checkout
|
- name: checkout
|
||||||
@@ -20,18 +21,73 @@ jobs:
|
|||||||
uses: actions/setup-go@v6
|
uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version-file: "go.mod"
|
go-version-file: "go.mod"
|
||||||
- name: release
|
- name: setup zig
|
||||||
uses: goreleaser/goreleaser-action@v7
|
uses: mlugg/setup-zig@v2
|
||||||
with:
|
with:
|
||||||
workdir: cmd/showbridge
|
version: 0.16.0
|
||||||
distribution: goreleaser
|
- name: setup env variables
|
||||||
version: "v2.13.0"
|
run: |
|
||||||
args: release --clean
|
echo "SHOWBRIDGE_VERSION=${GITHUB_REF_NAME}" >> $GITHUB_ENV
|
||||||
env:
|
echo "SHORT_COMMIT=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
- 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=linux GOARCH=amd64 CC="zig cc -target x86_64-linux-musl" CXX="zig c++ -target x86_64-linux-musl" go build -o showbridge -ldflags="-s -w -X main.version=${SHOWBRIDGE_VERSION}-${SHORT_COMMIT}" ./cmd/showbridge
|
||||||
|
tar -czf showbridge_${SHOWBRIDGE_VERSION}_linux-amd64.tar.gz showbridge
|
||||||
|
- name: build arm64
|
||||||
|
run: |
|
||||||
|
CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC="zig cc -target aarch64-linux-musl" CXX="zig c++ -target aarch64-linux-musl" go build -o showbridge -ldflags="-s -w -X main.version=${SHOWBRIDGE_VERSION}-${SHORT_COMMIT}" ./cmd/showbridge
|
||||||
|
tar -czf showbridge_${SHOWBRIDGE_VERSION}_linux-arm64.tar.gz showbridge
|
||||||
|
- name: upload linux artifacts
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
if: github.event_name == 'workflow_dispatch'
|
||||||
|
with:
|
||||||
|
name: showbridge-linux
|
||||||
|
path: |
|
||||||
|
showbridge_*.tar.gz
|
||||||
|
windows:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: setup go
|
||||||
|
uses: actions/setup-go@v6
|
||||||
|
with:
|
||||||
|
go-version-file: "go.mod"
|
||||||
|
- name: setup zig
|
||||||
|
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
|
||||||
|
zip showbridge_${SHOWBRIDGE_VERSION}_windows-amd64.zip showbridge
|
||||||
|
- name: build arm64
|
||||||
|
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'
|
||||||
|
with:
|
||||||
|
name: showbridge-windows
|
||||||
|
path: |
|
||||||
|
showbridge_*.zip
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: goreleaser
|
needs: linux
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
||||||
|
|||||||
Reference in New Issue
Block a user