name: Release on: push: tags: - 'v*.*.*' permissions: contents: write jobs: build: runs-on: ubuntu-latest strategy: matrix: include: - goos: linux goarch: amd64 - goos: linux goarch: arm64 - goos: darwin goarch: amd64 - goos: darwin goarch: arm64 - goos: windows goarch: amd64 - goos: windows goarch: arm64 steps: - uses: actions/checkout@v6 - name: Set up Go uses: actions/setup-go@v5 with: go-version-file: 'go.mod' - name: Build CLI env: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} CGO_ENABLED: '0' VERSION: ${{ github.ref_name }} run: | EXT="" if [ "$GOOS" = "windows" ]; then EXT=".exe"; fi go build -trimpath \ -ldflags="-s -w -X github.com/host-uk/core/pkg/cli.AppVersion=${VERSION}" \ -o core-${GOOS}-${GOARCH}${EXT} . - name: Upload artifact uses: actions/upload-artifact@v4 with: name: core-${{ matrix.goos }}-${{ matrix.goarch }} path: core-* release: needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 - name: Download all artifacts uses: actions/download-artifact@v4 with: path: artifacts merge-multiple: true - name: Generate checksums run: | cd artifacts sha256sum core-* > CHECKSUMS.txt cat CHECKSUMS.txt - name: Create release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gh release create ${{ github.ref_name }} \ --title "Release ${{ github.ref_name }}" \ --generate-notes \ artifacts/*