Update README.md #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Commit Go Binaries | |
on: | |
push: | |
branches: | |
- main | |
# paths: | |
# - '*.go' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goos: [linux, windows, darwin] | |
goarch: [amd64, arm64] | |
fail-fast: false | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.22' # Replace with your Go version | |
# - name: Set up GCC | |
# uses: egor-tensin/setup-gcc@v1 | |
# with: | |
# version: latest | |
# platform: ${{ matrix.goarch }} | |
- name: Pausing if darwin and arm64 | |
if: matrix.goos == 'darwin' && matrix.goarch == 'arm64' | |
run: | | |
echo "Exiting with error. Please push this manually" | |
exit 1 | |
- name: Build binary | |
run: | | |
cd heimdall/lib/ | |
go mod tidy | |
mkdir -p build/${{ matrix.goos }}_${{ matrix.goarch }} | |
go build -v -o build/libshuffleemail_${{ matrix.goos }}_${{ matrix.goarch }} -buildmode=c-shared *.go | |
env: | |
CGO_ENABLED: 1 | |
# GOOS: ${{ matrix.goos }} | |
# GOARCH: ${{ matrix.goarch }} | |
- name: Commit binaries | |
run: | | |
cd heimdall/lib/ | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
git config pull.rebase false # merge | |
mkdir -p binaries/ | |
mv build/libshuffleemail_${{ matrix.goos }}_${{ matrix.goarch }} binaries/ | |
git add binaries/ | |
git commit -m "Add compiled binaries for ${{ matrix.goos }} - ${{ matrix.goarch }}" | |
- name: Push changes | |
run: | | |
# sleep for a random amount of time between 1 and 10 seconds | |
sleep $((1 + RANDOM % 30)) | |
git pull | |
git push |