ci: trying to push binaries reliably (1) #14
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 | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goos: [linux, windows, darwin] | |
goarch: [amd64, arm64] | |
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]' | |
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 }}" | |
git push origin main |