Skip to content

ci: trying to push the built binaries (1) #12

ci: trying to push the built binaries (1)

ci: trying to push the built binaries (1) #12

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 }}
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o build/${{ matrix.goos }}_${{ matrix.goarch }}/libshuffleemail_${{ matrix.goos }} -buildmode=c-shared -v
env:
CGO_ENABLED: 1
- name: Commit binaries
run: |
cd shuffle_email_rules/lib/
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
branch_name="binaries-${{ github.sha }}"
git checkout -b $branch_name
mkdir -p binaries/${{ matrix.goos }}_${{ matrix.goarch }}
mv build/${{ matrix.goos }}_${{ matrix.goarch }}/libshuffleemail_${{ matrix.goos }} binaries/${{ matrix.goos }}_${{ matrix.goarch }}/
git add binaries/
git commit -m "Add compiled binaries for ${{ matrix.goos }}_${{ matrix.goarch }}"
git push origin $branch_name
- name: Create pull request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Add compiled binaries for ${{ matrix.goos }}_${{ matrix.goarch }}
branch: main
title: Add compiled binaries
body: |
This PR adds the compiled binaries for the following platform and architecture:
- OS: ${{ matrix.goos }}
- Architecture: ${{ matrix.goarch }}