56fd479761
- Updated the release workflow to consolidate build steps for different architectures. - Changed the variant name in README.md for clarity on static binaries compatibility. - Enhanced the packaging process to create release archives for each binary built. - Removed the matrix strategy for builds, simplifying the CI configuration.
82 lines
2.1 KiB
YAML
82 lines
2.1 KiB
YAML
name: Release Artifacts
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "*"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
release:
|
|
name: Build and publish release
|
|
runs-on: ubuntu-latest
|
|
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 release binaries
|
|
shell: bash
|
|
run: |
|
|
set -eu
|
|
mkdir -p dist
|
|
|
|
for arch in amd64 arm64; do
|
|
base="scratchbox-linux-${arch}"
|
|
|
|
CGO_ENABLED=0 GOOS=linux GOARCH="${arch}" \
|
|
go build -trimpath -ldflags "-s -w" \
|
|
-o "dist/${base}-default" ./cmd/scratchbox
|
|
|
|
CGO_ENABLED=0 GOOS=linux GOARCH="${arch}" \
|
|
go build -trimpath -tags "netgo osusergo" -ldflags "-s -w" \
|
|
-o "dist/${base}-static" ./cmd/scratchbox
|
|
|
|
file "dist/${base}-static" | grep -q "statically linked"
|
|
done
|
|
|
|
- name: Package release archives
|
|
shell: bash
|
|
run: |
|
|
set -eu
|
|
rm -rf release-packages
|
|
mkdir -p release-packages
|
|
|
|
for bin in dist/scratchbox-linux-*; do
|
|
name="$(basename "${bin}")"
|
|
archive="scratchbox-${{ github.ref_name }}-${name}.tar.gz"
|
|
stage="release-packages/${name}"
|
|
|
|
rm -rf "${stage}"
|
|
mkdir -p "${stage}"
|
|
cp README.md "${stage}/"
|
|
cp "${bin}" "${stage}/"
|
|
tar -C "${stage}" -czf "${archive}" .
|
|
done
|
|
|
|
- name: Create release and upload archives
|
|
uses: https://gitea.com/actions/gitea-release-action@v1
|
|
with:
|
|
tag_name: ${{ github.ref_name }}
|
|
name: ${{ github.ref_name }}
|
|
files: |-
|
|
scratchbox-${{ github.ref_name }}-linux-*.tar.gz
|