Github actions stuff part 2 #2
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: Go Build for Windows and Linux | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build-windows: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Build Go shared library (.dll) | |
run: | | |
cd go_spammer | |
go build -o spammer.dll -buildmode=c-shared main.go | |
mkdir -p ../shared | |
mv spammer.dll ../shared/spammer.dll | |
- name: Commit and push changes | |
run: | | |
git config --global user.email "your-email@example.com" | |
git config --global user.name "GitHub Actions" | |
git add ../shared/spammer.dll | |
git commit -m "Add built spammer.dll for Windows" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-linux: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- name: Install GCC | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y build-essential | |
- name: Build Go shared library (.so) | |
run: | | |
cd go_spammer | |
go build -o spammer.so -buildmode=c-shared main.go | |
mkdir -p ../shared | |
mv spammer.so ../shared/spammer.so | |
- name: Commit and push changes | |
run: | | |
git config --global user.email "your-email@example.com" | |
git config --global user.name "GitHub Actions" | |
git add ../shared/spammer.so | |
git commit -m "Add built spammer.so for Linux" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |