67 lines
1.8 KiB
YAML
67 lines
1.8 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches: [main, daemon]
|
|
tags: ['v*']
|
|
pull_request:
|
|
branches: [main, daemon]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- goos: linux
|
|
goarch: amd64
|
|
- goos: linux
|
|
goarch: arm64
|
|
- goos: linux
|
|
goarch: arm
|
|
goarm: '7'
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v6
|
|
with:
|
|
go-version: '1.22'
|
|
cache: true
|
|
|
|
- name: Vet
|
|
run: go vet ./...
|
|
|
|
- name: Build
|
|
env:
|
|
CGO_ENABLED: '0'
|
|
GOOS: ${{ matrix.goos }}
|
|
GOARCH: ${{ matrix.goarch }}
|
|
GOARM: ${{ matrix.goarm }}
|
|
GOFLAGS: -trimpath -ldflags=-s -ldflags=-w
|
|
run: make build
|
|
|
|
- name: Package
|
|
run: |
|
|
arch="${{ matrix.goarch }}${{ matrix.goarm && format('v{0}', matrix.goarm) || '' }}"
|
|
name="bleh-${{ matrix.goos }}-${arch}"
|
|
stage="dist-stage/${name}"
|
|
mkdir -p "${stage}/bin" "${stage}/dist"
|
|
cp bin/bleh bin/blehd "${stage}/bin/"
|
|
cp -r dist/systemd dist/openrc dist/INSTALL.md "${stage}/dist/"
|
|
cp README.md LICENSE LICENSE.gplv3 LICENSE.mit "${stage}/"
|
|
tar -C dist-stage -czf "${name}.tar.gz" "${name}"
|
|
sha256sum "${name}.tar.gz" > "${name}.tar.gz.sha256"
|
|
echo "ARTIFACT=${name}" >> "$GITHUB_ENV"
|
|
|
|
- name: Upload artifact
|
|
uses: https://github.com/christopherHX/gitea-upload-artifact@v4
|
|
with:
|
|
name: ${{ env.ARTIFACT }}
|
|
path: |
|
|
${{ env.ARTIFACT }}.tar.gz
|
|
${{ env.ARTIFACT }}.tar.gz.sha256
|
|
if-no-files-found: error
|