mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-08-11 17:33:38 +00:00
3adbae8068
Bump docker/login-action from 4.1.0 to 4.2.0
250 lines
9.1 KiB
YAML
250 lines
9.1 KiB
YAML
name: showbridge release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
workflow_dispatch:
|
|
|
|
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
|
|
- name: create release
|
|
uses: softprops/action-gh-release@v3
|
|
if: github.ref_type == 'tag' && github.event_name != 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/v')
|
|
with:
|
|
draft: true
|
|
generate_release_notes: true
|
|
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
|
|
with:
|
|
fetch-depth: 0
|
|
- name: setup go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version-file: "go.mod"
|
|
- name: install alsa lib
|
|
run: sudo apt-get install -y libasound2-dev
|
|
- name: build
|
|
run: |
|
|
CGO_ENABLED=1 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: upload linux artifacts
|
|
uses: actions/upload-artifact@v7
|
|
if: github.event_name == 'workflow_dispatch'
|
|
with:
|
|
name: showbridge-linux-amd64
|
|
path: |
|
|
showbridge_*.tar.gz
|
|
- name: upload artifacts to release
|
|
uses: softprops/action-gh-release@v3
|
|
if: github.ref_type == 'tag' && github.event_name != 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/v')
|
|
with:
|
|
draft: true
|
|
files: 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
|
|
with:
|
|
fetch-depth: 0
|
|
- name: setup go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version-file: "go.mod"
|
|
- name: install alsa lib
|
|
run: sudo apt-get install -y libasound2-dev
|
|
- name: build
|
|
run: |
|
|
CGO_ENABLED=1 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-arm64
|
|
path: |
|
|
showbridge_*.tar.gz
|
|
- name: upload artifacts to release
|
|
uses: softprops/action-gh-release@v3
|
|
if: github.ref_type == 'tag' && github.event_name != 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/v')
|
|
with:
|
|
draft: true
|
|
files: 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
|
|
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: 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.exe -ldflags="-s -w -X main.version=${SHOWBRIDGE_VERSION}-${SHORT_COMMIT}" ./cmd/showbridge
|
|
zip showbridge_${SHOWBRIDGE_VERSION}_windows-amd64.zip showbridge.exe
|
|
- 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.exe -ldflags="-s -w -X main.version=${SHOWBRIDGE_VERSION}-${SHORT_COMMIT}" ./cmd/showbridge
|
|
zip showbridge_${SHOWBRIDGE_VERSION}_windows-arm64.zip showbridge.exe
|
|
- name: upload windows artifacts
|
|
uses: actions/upload-artifact@v7
|
|
if: github.event_name == 'workflow_dispatch'
|
|
with:
|
|
name: showbridge-windows
|
|
path: |
|
|
showbridge_*.zip
|
|
- name: upload artifacts to release
|
|
uses: softprops/action-gh-release@v3
|
|
if: github.ref_type == 'tag' && github.event_name != 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/v')
|
|
with:
|
|
draft: true
|
|
files: showbridge_*.zip
|
|
macos_arm64:
|
|
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
|
|
with:
|
|
fetch-depth: 0
|
|
- name: setup go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version-file: "go.mod"
|
|
- name: build
|
|
run: |
|
|
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'
|
|
with:
|
|
name: showbridge-macos-arm64
|
|
path: |
|
|
showbridge_*.tar.gz
|
|
- name: upload artifacts to release
|
|
uses: softprops/action-gh-release@v3
|
|
if: github.ref_type == 'tag' && github.event_name != 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/v')
|
|
with:
|
|
draft: true
|
|
files: showbridge_*.tar.gz
|
|
macos_amd64:
|
|
runs-on: macos-26-intel
|
|
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
|
|
with:
|
|
fetch-depth: 0
|
|
- name: setup go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version-file: "go.mod"
|
|
- name: build
|
|
run: |
|
|
CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 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: upload macos artifacts
|
|
uses: actions/upload-artifact@v7
|
|
if: github.event_name == 'workflow_dispatch'
|
|
with:
|
|
name: showbridge-macos-amd64
|
|
path: |
|
|
showbridge_*.tar.gz
|
|
- name: upload artifacts to release
|
|
uses: softprops/action-gh-release@v3
|
|
if: github.ref_type == 'tag' && github.event_name != 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/v')
|
|
with:
|
|
draft: true
|
|
files: showbridge_*.tar.gz
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
needs: setup_release
|
|
if: github.ref_type == 'tag' && github.event_name != 'workflow_dispatch'
|
|
steps:
|
|
- name: Check out repository
|
|
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@ce360397dd3f832beb865e1373c09c0e9f86d70a # v4.0.0
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
|
|
|
|
- name: Login to Docker Hub
|
|
uses: docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2.0
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Setup Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@80c7e94dd9b9319bd5eb7a0e0fe9291e23a2a2e9 # v6.1.0
|
|
with:
|
|
images: |
|
|
jwetzell/showbridge
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
|
|
with:
|
|
push: true
|
|
context: ./
|
|
file: ./Dockerfile
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|
|
platforms: linux/amd64
|