Skip to content

Updated github actions #18

Updated github actions

Updated github actions #18

Workflow file for this run

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
if (Test-Path ../shared/spammer.dll) { Remove-Item ../shared/spammer.dll }
Move-Item spammer.dll ../shared/spammer.dll
shell: pwsh
- name: Configure Git
run: |
git config --global user.email "lmy615730@gmail.com"
git config --global user.name "GitHub Actions"
- name: Check for changes and commit
run: |
git stash
git pull --rebase
git stash pop
git diff --exit-code || (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
if [ -f ../shared/spammer.so ]; then rm ../shared/spammer.so; fi
mv spammer.so ../shared/spammer.so
- name: Configure Git
run: |
git config --global user.email "lmy615730@gmail.com"
git config --global user.name "GitHub Actions"
- name: Check for changes and commit
run: |
git stash
git pull --rebase
git stash pop
git diff --exit-code || (git add shared/spammer.so && git commit -m "Add built spammer.so for Linux" && git push)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}