diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml new file mode 100644 index 0000000..3041af2 --- /dev/null +++ b/.gitea/workflows/build.yml @@ -0,0 +1,66 @@ +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: actions/upload-artifact@v7 + with: + name: ${{ env.ARTIFACT }} + path: | + ${{ env.ARTIFACT }}.tar.gz + ${{ env.ARTIFACT }}.tar.gz.sha256 + if-no-files-found: error