diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml index 13fbdc35..16b21554 100644 --- a/.github/workflows/release-binaries.yml +++ b/.github/workflows/release-binaries.yml @@ -8,8 +8,18 @@ on: types: [completed] jobs: bin-releaser: - name: Release Binaries - runs-on: ubuntu-latest + name: Release Binaries (${{ matrix.runner }}) + strategy: + fail-fast: false + matrix: + include: + - runner: ubuntu-latest + config: .goreleaser.yaml + needs_zig: true + - runner: macos-latest + config: .goreleaser.darwin.yaml + needs_zig: false + runs-on: ${{ matrix.runner }} steps: - name: Checkout uses: actions/checkout@v3 @@ -19,11 +29,22 @@ jobs: uses: actions/setup-go@v5 with: go-version-file: 'go.mod' + # curl zig directly; setup-zig actions have unreliable mirror pools + - name: Set up Zig + if: matrix.needs_zig + run: | + set -eu + ZV=0.14.1 + curl -sL https://ziglang.org/download/${ZV}/zig-x86_64-linux-${ZV}.tar.xz -o /tmp/zig.tar.xz + mkdir -p "$HOME/zig-${ZV}" + tar -xJf /tmp/zig.tar.xz -C "$HOME/zig-${ZV}" --strip-components=1 + echo "$HOME/zig-${ZV}" >> "$GITHUB_PATH" + "$HOME/zig-${ZV}/zig" version - name: Release Binaries uses: goreleaser/goreleaser-action@v4 with: distribution: goreleaser version: latest - args: ${{ github.event_name == 'pull_request' && 'release --snapshot --skip-publish' || 'release --clean' }} + args: release --clean --config ${{ matrix.config }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.darwin.yaml b/.goreleaser.darwin.yaml new file mode 100644 index 00000000..83cb93f5 --- /dev/null +++ b/.goreleaser.darwin.yaml @@ -0,0 +1,35 @@ +version: 2 + +project_name: singularity + +builds: + - id: singularity-darwin + env: + - CGO_ENABLED=1 + binary: singularity + goos: + - darwin + goarch: + - amd64 + - arm64 + mod_timestamp: '{{.CommitTimestamp}}' + +archives: + - format_overrides: + - goos: darwin + formats: [zip] + name_template: '{{ .ProjectName }}_{{ .Version }}_mac_os_{{ .Arch }}' + files: + - LICENSE + - README.md + - docs/* + +release: + mode: keep-existing + +changelog: + disable: true + +checksum: + name_template: 'checksums-darwin.txt' + disable: false diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 74382123..5ad8a3ca 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -1,28 +1,45 @@ version: 2 builds: - - env: - - CGO_ENABLED=0 + - id: singularity-nixwin + env: + - CGO_ENABLED=1 binary: singularity goos: - linux - windows - - darwin goarch: - amd64 - arm64 + overrides: + - goos: linux + goarch: amd64 + env: + - CC=zig cc -target x86_64-linux-gnu + - CXX=zig c++ -target x86_64-linux-gnu + - goos: linux + goarch: arm64 + env: + - CC=zig cc -target aarch64-linux-gnu + - CXX=zig c++ -target aarch64-linux-gnu + - goos: windows + goarch: amd64 + env: + - CC=zig cc -target x86_64-windows-gnu + - CXX=zig c++ -target x86_64-windows-gnu + - goos: windows + goarch: arm64 + env: + - CC=zig cc -target aarch64-windows-gnu + - CXX=zig c++ -target aarch64-windows-gnu mod_timestamp: '{{.CommitTimestamp}}' archives: - format_overrides: - goos: windows - format: zip - - goos: darwin - format: zip + formats: [zip] name_template: >- - {{ .ProjectName }}_{{ .Version }}_ - {{- if eq .Os "darwin" }}mac_os - {{- else }}{{ .Os }}{{ end }}_{{ .Arch }} + {{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }} files: - LICENSE - README.md @@ -35,6 +52,7 @@ changelog: disable: true checksum: + name_template: 'checksums-nixwin.txt' disable: false nfpms: