This commit is contained in:
56
.gitea/workflows/release.yml
Normal file
56
.gitea/workflows/release.yml
Normal file
@@ -0,0 +1,56 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [amd64] # [amd64, arm64]
|
||||
|
||||
# Build in Alpine => musl toolchain
|
||||
container:
|
||||
image: golang:alpine
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Deps (musl toolchain)
|
||||
run: |
|
||||
apk add --no-cache git build-base musl-dev
|
||||
|
||||
- name: Go env
|
||||
run: |
|
||||
go version
|
||||
go env
|
||||
|
||||
- name: Build (linux/musl)
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: ${{ matrix.arch }}
|
||||
CGO_ENABLED: "0"
|
||||
run: |
|
||||
mkdir -p dist
|
||||
BIN="kc-policy-${GOOS}-${GOARCH}-musl"
|
||||
go build -trimpath \
|
||||
-ldflags="-s -w" \
|
||||
-o "dist/${BIN}" ./cmd/kc-policy
|
||||
|
||||
tar -C dist -czf "dist/${BIN}.tar.gz" "${BIN}"
|
||||
sha256sum "dist/${BIN}.tar.gz" > "dist/${BIN}.tar.gz.sha256"
|
||||
|
||||
- name: Upload assets to Gitea release
|
||||
uses: actions/gitea-release-action@v1
|
||||
with:
|
||||
token: ${{ github.token }}
|
||||
files: |
|
||||
dist/*.tar.gz
|
||||
dist/*.sha256
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
Reference in New Issue
Block a user