diff --git a/.github/workflows/release-showbridge.yaml b/.github/workflows/release-showbridge.yaml index b03114e..28bdf03 100644 --- a/.github/workflows/release-showbridge.yaml +++ b/.github/workflows/release-showbridge.yaml @@ -4,12 +4,13 @@ on: push: tags: - "v*" + workflow_dispatch: permissions: contents: write jobs: - goreleaser: + linux: runs-on: ubuntu-latest steps: - name: checkout @@ -20,18 +21,73 @@ jobs: uses: actions/setup-go@v6 with: go-version-file: "go.mod" - - name: release - uses: goreleaser/goreleaser-action@v7 + - name: setup zig + uses: mlugg/setup-zig@v2 with: - workdir: cmd/showbridge - distribution: goreleaser - version: "v2.13.0" - args: release --clean - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + 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=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: runs-on: ubuntu-latest - needs: goreleaser + needs: linux steps: - name: Check out repository uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0