@@ -3,55 +3,67 @@ name: Go Build for Windows and Linux
3
3
on :
4
4
push :
5
5
branches :
6
- - main
6
+ - main
7
7
pull_request :
8
8
9
9
jobs :
10
10
build-windows :
11
- runs-on : windows-latest
11
+ runs-on : windows-latest
12
12
steps :
13
13
- name : Checkout code
14
14
uses : actions/checkout@v3
15
15
16
16
- name : Set up Go
17
17
uses : actions/setup-go@v4
18
18
with :
19
- go-version : ' 1.21'
19
+ go-version : ' 1.21'
20
20
21
21
- name : Build Go shared library (.dll)
22
22
run : |
23
- cd go_spammer
24
- go build -o ../shared/spammer.dll -buildmode=c-shared main.go
23
+ cd go_spammer
24
+ go build -o spammer.dll -buildmode=c-shared main.go
25
+ mkdir -p ../shared
26
+ mv spammer.dll ../shared/spammer.dll
25
27
26
- - name : Upload DLL artifact
27
- uses : actions/upload-artifact@v3
28
- with :
29
- name : spammer-dll
30
- path : ./shared/spammer.dll
28
+ - name : Commit and push changes
29
+ run : |
30
+ git config --global user.email "[email protected] "
31
+ git config --global user.name "GitHub Actions"
32
+ git add ../shared/spammer.dll
33
+ git commit -m "Add built spammer.dll for Windows"
34
+ git push
35
+ env :
36
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
31
37
32
38
build-linux :
33
- runs-on : ubuntu-latest
39
+ runs-on : ubuntu-latest
34
40
steps :
35
41
- name : Checkout code
36
42
uses : actions/checkout@v3
37
43
38
44
- name : Set up Go
39
45
uses : actions/setup-go@v4
40
46
with :
41
- go-version : ' 1.21'
47
+ go-version : ' 1.21'
42
48
43
49
- name : Install GCC
44
50
run : |
45
51
sudo apt-get update
46
- sudo apt-get install -y build-essential # نصب GCC و ابزارهای ضروری برای بیلد
52
+ sudo apt-get install -y build-essential
47
53
48
54
- name : Build Go shared library (.so)
49
55
run : |
50
- cd go_spammer # به پوشهی go_spammer بروید
51
- go build -o ../shared/spammer.so -buildmode=c-shared main.go # بیلد کتابخانه بهصورت shared برای لینوکس
56
+ cd go_spammer
57
+ go build -o spammer.so -buildmode=c-shared main.go
58
+ mkdir -p ../shared
59
+ mv spammer.so ../shared/spammer.so
52
60
53
- - name : Upload SO artifact
54
- uses : actions/upload-artifact@v3
55
- with :
56
- name : spammer-so
57
- path : ./shared/spammer.so
61
+ - name : Commit and push changes
62
+ run : |
63
+ git config --global user.email "[email protected] "
64
+ git config --global user.name "GitHub Actions"
65
+ git add ../shared/spammer.so
66
+ git commit -m "Add built spammer.so for Linux"
67
+ git push
68
+ env :
69
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments