Merge branch 'main' of github.com:Shuffle/shuffle-email-rules #25
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-ignore: | |
- 'shuffle_email_rules/lib/binaries/**' | |
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: Build binary | |
run: | | |
cd shuffle_email_rules/lib/ | |
go mod tidy | |
mkdir -p build/${{ matrix.goos }}_${{ matrix.goarch }} | |
go build -v -o build/libshuffleemail_${{ matrix.goos }}_${{ matrix.goarch }} -buildmode=c-shared | |
env: | |
CGO_ENABLED: 1 | |
# GOOS: ${{ matrix.goos }} | |
# GOARCH: ${{ matrix.goarch }} | |
- name: Commit binaries | |
run: | | |
cd shuffle_email_rules/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 }}" | |
# sleep for a random amount of time between 1 and 10 seconds | |
sleep $((1 + RANDOM % 30)) | |
git pull | |
git push |