|
4 | 4 | workflow_dispatch: |
5 | 5 | inputs: |
6 | 6 | 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)' |
8 | 8 | required: true |
9 | 9 | default: 'v0.1.0-alpha' |
10 | 10 |
|
11 | 11 | jobs: |
12 | 12 | 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 }} |
14 | 33 | steps: |
15 | 34 | - uses: actions/checkout@v4 |
16 | | - |
17 | | - |
18 | 35 | - uses: actions/setup-go@v5 |
19 | 36 | with: |
20 | 37 | go-version: '1.22' |
21 | | - |
| 38 | + - name: Install Zip tool (for Windows only) |
| 39 | + if: runner.os == 'Windows' |
| 40 | + run: choco install zip |
22 | 41 | - name: Install Dependencies |
23 | 42 | run: go mod tidy |
24 | 43 | 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 |
26 | 52 | - name: Build Go Executable |
27 | 53 | 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 |
32 | 58 | - 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 |
36 | 64 | uses: actions/upload-artifact@v4 |
37 | 65 | 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 }} |
40 | 68 |
|
41 | 69 | create-release: |
42 | 70 | needs: build-and-release |
|
45 | 73 | - uses: actions/checkout@v4 |
46 | 74 | with: |
47 | 75 | token: ${{ secrets.GITHUB_TOKEN }} |
48 | | - |
| 76 | + |
| 77 | + |
49 | 78 | - name: Create empty commit for release |
50 | 79 | run: | |
51 | 80 | git config user.name "github-actions" |
|
63 | 92 | with: |
64 | 93 | tag_name: ${{ github.event.inputs.tag_name }} |
65 | 94 | name: Release ${{ github.event.inputs.tag_name }} |
66 | | - body: "" |
| 95 | + body: "" |
67 | 96 | files: artifacts/**/*.zip |
0 commit comments