44 workflow_dispatch :
55 inputs :
66 tag_name :
7- description : ' The tag name for the release (e.g., v0.1.0-test )'
7+ description : ' The tag name for the release (e.g., v0.1.0)'
88 required : true
99 default : ' v0.1.0-alpha'
1010
1111jobs :
1212 build-and-release :
13- strategy :
14- matrix :
15- include :
16- - os : windows-latest
17- goos : windows
18- goarch : amd64
19- arch_name : " 64"
20- - os : ubuntu-latest
21- goos : linux
22- goarch : amd64
23- arch_name : " 64"
24- - os : macos-latest
25- goos : darwin
26- goarch : amd64
27- arch_name : " 64"
28- - os : macos-latest
29- goos : darwin
30- goarch : arm64
31- arch_name : " arm64-v8a"
32- runs-on : ${{ matrix.os }}
13+ runs-on : ubuntu-latest
3314 steps :
3415 - uses : actions/checkout@v4
16+
17+
3518 - uses : actions/setup-go@v5
3619 with :
3720 go-version : ' 1.22'
38- - name : Install Zip tool (for Windows only)
39- if : runner.os == 'Windows'
40- run : choco install zip
21+
4122 - name : Install Dependencies
4223 run : go mod tidy
4324 working-directory : ./core_engine
44- - name : Set output names
45- id : set_names
46- shell : bash
47- run : |
48- EXE_NAME="core_engine"
49- if [ "${{ matrix.goos }}" == "windows" ]; then EXE_NAME="core_engine.exe"; fi
50- echo "EXE_NAME=$EXE_NAME" >> $GITHUB_ENV
51- echo "ZIP_NAME=core_engine-${{ matrix.goos }}-${{ matrix.arch_name }}.zip" >> $GITHUB_ENV
25+
5226 - name : Build Go Executable
5327 env :
54- GOOS : ${{ matrix.goos }}
55- GOARCH : ${{ matrix.goarch }}
56- run : go build -v -o ${{ env.EXE_NAME }} .
57- working-directory : ./core_engine
28+ GOOS : linux
29+ GOARCH : amd64
30+ run : go build -v -o core_engine ./core_engine
31+
5832 - name : Create Zip Archive
59- shell : bash
60- run : |
61- cd core_engine
62- zip ${{ env.ZIP_NAME }} ${{ env.EXE_NAME }}
63- - name : Upload Artifact for the Release job
33+ run : zip core_engine.zip core_engine
34+
35+ - name : Upload Artifact
6436 uses : actions/upload-artifact@v4
6537 with :
66- name : release-asset-${{ matrix.goos }}-${{ matrix.arch_name }}
67- path : core_engine/${{ env.ZIP_NAME }}
38+ name : release-artifact
39+ path : core_engine.zip
6840
6941 create-release :
7042 needs : build-and-release
@@ -73,28 +45,24 @@ jobs:
7345 - uses : actions/checkout@v4
7446 with :
7547 token : ${{ secrets.GITHUB_TOKEN }}
76-
77- - name : Create dummy commit for release
48+
49+ # 🔹 Commit خالی ایجاد میکنیم تا release روی commit جدید باشه
50+ - name : Create empty commit for release
7851 run : |
79- echo "Release ${{ github.event.inputs.tag_name }}" > RELEASE_TAG.txt
8052 git config user.name "github-actions"
8153 git config user.email "github-actions@github.com"
82- git add RELEASE_TAG.txt
83- git commit -m "Action: prepare release ${{ github.event.inputs.tag_name }}"
84-
54+ git commit --allow-empty -m "chore: release ${{ github.event.inputs.tag_name }}"
8555 git push origin HEAD:main
86-
56+
8757 - name : Download all build artifacts
8858 uses : actions/download-artifact@v4
8959 with :
9060 path : artifacts
91-
61+
9262 - name : Create Release and Upload Assets
9363 uses : softprops/action-gh-release@v2
9464 with :
9565 tag_name : ${{ github.event.inputs.tag_name }}
9666 name : Release ${{ github.event.inputs.tag_name }}
97- body : |
98- ## Installion
67+ body : " "
9968 files : artifacts/**/*.zip
100-
0 commit comments