Skip to content

Commit 9b26d40

Browse files
Update go.yml
1 parent f327b6a commit 9b26d40

File tree

1 file changed

+46
-17
lines changed

1 file changed

+46
-17
lines changed

.github/workflows/go.yml

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,67 @@ on:
44
workflow_dispatch:
55
inputs:
66
tag_name:
7-
description: 'The tag name for the release (e.g., v0.1.0)'
7+
description: 'The tag name for the release (e.g., v0.1.0-test)'
88
required: true
99
default: 'v0.1.0-alpha'
1010

1111
jobs:
1212
build-and-release:
13-
runs-on: ubuntu-latest
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 }}
1433
steps:
1534
- uses: actions/checkout@v4
16-
17-
1835
- uses: actions/setup-go@v5
1936
with:
2037
go-version: '1.22'
21-
38+
- name: Install Zip tool (for Windows only)
39+
if: runner.os == 'Windows'
40+
run: choco install zip
2241
- name: Install Dependencies
2342
run: go mod tidy
2443
working-directory: ./core_engine
25-
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
2652
- name: Build Go Executable
2753
env:
28-
GOOS: linux
29-
GOARCH: amd64
30-
run: go build -v -o core_engine ./core_engine
31-
54+
GOOS: ${{ matrix.goos }}
55+
GOARCH: ${{ matrix.goarch }}
56+
run: go build -v -o ${{ env.EXE_NAME }} .
57+
working-directory: ./core_engine
3258
- name: Create Zip Archive
33-
run: zip core_engine.zip core_engine
34-
35-
- name: Upload Artifact
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
3664
uses: actions/upload-artifact@v4
3765
with:
38-
name: release-artifact
39-
path: core_engine.zip
66+
name: release-asset-${{ matrix.goos }}-${{ matrix.arch_name }}
67+
path: core_engine/${{ env.ZIP_NAME }}
4068

4169
create-release:
4270
needs: build-and-release
@@ -45,7 +73,8 @@ jobs:
4573
- uses: actions/checkout@v4
4674
with:
4775
token: ${{ secrets.GITHUB_TOKEN }}
48-
76+
77+
4978
- name: Create empty commit for release
5079
run: |
5180
git config user.name "github-actions"
@@ -63,5 +92,5 @@ jobs:
6392
with:
6493
tag_name: ${{ github.event.inputs.tag_name }}
6594
name: Release ${{ github.event.inputs.tag_name }}
66-
body: ""
95+
body: ""
6796
files: artifacts/**/*.zip

0 commit comments

Comments
 (0)