Skip to content

Commit

Permalink
add ghcr.io/gorelease-cross docker to cross-compile binaries (#66)
Browse files Browse the repository at this point in the history
aims to fix broken goreleaser actions
  • Loading branch information
cortze authored May 8, 2024
1 parent 60804de commit 69316c1
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 50 deletions.
30 changes: 19 additions & 11 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,26 @@ jobs:
with:
fetch-depth: 0

- name: Install compiling essentials
run: |
sudo apt-get install -y gcc-multilib
- name: Setting up Go
uses: actions/setup-go@v4
with:
go-version: '1.19'

- name: Install cross-compiler for linux/arm64
run: sudo apt-get -y install gcc-aarch64-linux-gnu

- name: Install make
run: sudo apt-get -y install make

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Running GoReleaser
uses: goreleaser/goreleaser-action@v5
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
docker run --rm \
-e GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
-v /var/run/docker.sock:/var/run/docker.sock \
ghcr.io/goreleaser/goreleaser-cross:v1.19.6 build --clean --config .goreleaser.yaml
109 changes: 70 additions & 39 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,52 +5,83 @@
# Feel free to remove those if you don't want/need to use them.
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
# vim: set ts=2 sw=2 tw=0 fo=cnqoj

version: 1

project_name: nebula

before:
hooks:
- go mod tidy
- go run ./cmd/prefix/gen.go
builds:
- id: nebula
- id: linux-amd64
main: ./cmd/nebula
binary: nebula
env:
- CGO_ENABLED=1
- CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++
binary: nebula-linux-amd64
goos:
- linux
- windows
- darwin
overrides:
- goos: darwin
goarch: amd64
env:
- CC=o64-clang
- CXX=o64-clang++
- goos: darwin
goarch: arm64
env:
- CC=oa64-clang
- CXX=oa64-clang++
- goos: linux
goarch: amd64
env:
- CC=x86_64-linux-gnu-gcc
- CXX=x86_64-linux-gnu-g++
- goos: linux
goarch: arm64
env:
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
- goos: windows
goarch: amd64
env:
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++
- goos: windows
goarch: arm64
env:
- CC=aarch64-w64-mingw32-gcc
- CXX=aarch64-w64-mingw32-g++
- linux
goarch:
- amd64
ldflags:
- -s -w

- id: linux-arm64
main: ./cmd/nebula
env:
- CGO_ENABLED=1
- CC=aarch64-linux-gnu-gcc
- CXX=aarch64-linux-gnu-g++
binary: nebula-linux-arm64
goos:
- linux
goarch:
- arm64
ldflags:
- -s -w

- id: windows-amd64
main: ./cmd/nebula
env:
- CGO_ENABLED=1
- CC=x86_64-w64-mingw32-gcc
- CXX=x86_64-w64-mingw32-g++
binary: nebula-win-amd64
goos:
- windows
goarch:
- amd64
ldflags:
- -s -w

- id: darwin-amd64
main: ./cmd/nebula
env:
- CGO_ENABLED=1
- CC=o64-clang
- CXX=o64-clang++
binary: nebula-darwin-amd64
goos:
- darwin
goarch:
- amd64
ldflags:
- -s -w

- id: darwin-arm64
main: ./cmd/nebula
env:
- CGO_ENABLED=1
- CC=o64-clang
- CXX=o64-clang++
binary: nebula-darwin-arm64
goos:
- darwin
goarch:
- arm64
ldflags:
- -s -w

release:
draft: true

Expand Down

0 comments on commit 69316c1

Please sign in to comment.