ci: add static go releases for linux arm64 and amd64 (#111)

* ci: add static go releases for linux arm64 and amd64

Signed-off-by: Christoph Settgast <csett86_git@quicksands.de>

* ci: dynamically get go version for release

* pin actions to specific commits

* ci: fail if static binary is not created

---------

Signed-off-by: Christoph Settgast <csett86_git@quicksands.de>
This commit is contained in:
Christoph Settgast
2025-07-30 23:31:30 +02:00
committed by GitHub
parent 114f0f4560
commit 321ff70ce4

View File

@@ -6,14 +6,47 @@ permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
os: ["linux"]
arch: ["amd64", "arm64"]
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
with:
go-version-file: go.mod
- run: mkdir build
- run: go build -trimpath -o build/lk-jwt-service_${{ matrix.os }}_${{ matrix.arch }}
env:
CGO_ENABLED: 0
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
- name: "Upload binary as artifact"
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: build-${{ matrix.os }}-${{ matrix.arch }}
path: build/lk-jwt-service_${{ matrix.os }}_${{ matrix.arch }}
if-no-files-found: error
create-release:
needs: ["build"]
runs-on: ubuntu-latest
steps:
- name: "Extract version"
run: echo "IMAGE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: "Fetch all binaries"
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
path: build
pattern: build-*
merge-multiple: true
- name: "Create release"
uses: softprops/action-gh-release@da05d552573ad5aba039eaac05058a918a7bf631 # v2.2.2
with:
files: build/*
fail_on_unmatched_files: true
draft: true
generate_release_notes: true
body: |
@@ -24,3 +57,7 @@ jobs:
```
docker pull ghcr.io/element-hq/lk-jwt-service:${{env.IMAGE_VERSION}}
```
## Precompiled binaries
The service is available as static precompiled binaries for amd64 and arm64 on linux attached to this release below.