Files
scratchbox/.gitea/workflows/release.yaml
T
s1d3sw1ped 051e3c3c64
CI / Go Tests (push) Successful in 11s
CI / Build (push) Successful in 8s
Format / gofmt (push) Successful in 5s
Release Artifacts / Build linux/amd64 (default) (push) Successful in 22s
Release Artifacts / Build linux/amd64 (alpine-static) (push) Successful in 13s
Release Artifacts / Build linux/arm64 (default) (push) Successful in 17s
Release Artifacts / Build linux/arm64 (alpine-static) (push) Successful in 14s
Update artifact upload action in release workflow to use a direct URL
2026-06-01 02:11:56 -05:00

93 lines
2.9 KiB
YAML

name: Release Artifacts
on:
push:
tags:
- "*"
workflow_dispatch:
jobs:
build:
name: Build ${{ matrix.goos }}/${{ matrix.goarch }} (${{ matrix.variant }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
variant: default
static: false
- goos: linux
goarch: amd64
variant: alpine-static
static: true
- goos: linux
goarch: arm64
variant: default
static: false
- goos: linux
goarch: arm64
variant: alpine-static
static: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: web/ui/package-lock.json
- name: Install UI deps
run: npm --prefix ./web/ui ci
- name: Build UI assets
run: npm --prefix ./web/ui run build
- name: Build binary
shell: bash
run: |
mkdir -p dist
if [[ "${{ matrix.static }}" == "true" ]]; then
CGO_ENABLED=0 GOOS="${{ matrix.goos }}" GOARCH="${{ matrix.goarch }}" \
go build -trimpath -tags "netgo osusergo" \
-ldflags "-s -w" \
-o "dist/scratchbox-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.variant }}" \
./cmd/scratchbox
else
CGO_ENABLED=0 GOOS="${{ matrix.goos }}" GOARCH="${{ matrix.goarch }}" \
go build -trimpath \
-ldflags "-s -w" \
-o "dist/scratchbox-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.variant }}" \
./cmd/scratchbox
fi
- name: Verify static linux binary
if: ${{ matrix.static }}
shell: bash
run: |
file "dist/scratchbox-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.variant }}" | grep -q "statically linked"
- name: Package artifact
shell: bash
run: |
mkdir -p artifacts
cp README.md artifacts/
cp "dist/scratchbox-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.variant }}" artifacts/
tar -C artifacts -czf "scratchbox-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.variant }}.tar.gz" .
- name: Upload artifact
uses: https://gitea.com/actions/gitea-upload-artifact@v4
with:
name: scratchbox-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.variant }}
path: scratchbox-${{ github.ref_name }}-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.variant }}.tar.gz