-
Notifications
You must be signed in to change notification settings - Fork 11
112 lines (102 loc) · 3.34 KB
/
go.yml
File metadata and controls
112 lines (102 loc) · 3.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Manual Release Creator
on:
workflow_dispatch:
inputs:
tag_name:
description: 'The tag name for the release (e.g., v0.1.0-test)'
required: true
default: 'v0.1.0-alpha'
release_body:
description: 'The release notes/body for the release.'
required: true
default: 'This is a new release.'
jobs:
build-and-release:
strategy:
matrix:
include:
- os: windows-latest
goos: windows
goarch: amd64
arch_name: "64"
- os: ubuntu-latest
goos: linux
goarch: amd64
arch_name: "64"
- os: ubuntu-latest
goos: linux
goarch: arm64
arch_name: "arm64"
- os: macos-latest
goos: darwin
goarch: amd64
arch_name: "64"
- os: macos-latest
goos: darwin
goarch: arm64
arch_name: "arm64-v8a"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Install Zip tool (for Windows only)
if: runner.os == 'Windows'
run: choco install zip
- name: Install Dependencies
run: go mod tidy
working-directory: ./core_engine
- name: Set output names
id: set_names
shell: bash
run: |
EXE_NAME="core_engine"
if [ "${{ matrix.goos }}" == "windows" ]; then EXE_NAME="core_engine.exe"; fi
echo "EXE_NAME=$EXE_NAME" >> $GITHUB_ENV
echo "ZIP_NAME=core_engine-${{ matrix.goos }}-${{ matrix.arch_name }}.zip" >> $GITHUB_ENV
- name: Build Go Executable
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: go build -v -o ${{ env.EXE_NAME }} .
working-directory: ./core_engine
- name: Create Zip Archive
shell: bash
run: |
cd core_engine
zip ${{ env.ZIP_NAME }} ${{ env.EXE_NAME }}
- name: Upload Artifact for the Release job
uses: actions/upload-artifact@v4
with:
name: release-asset-${{ matrix.goos }}-${{ matrix.arch_name }}
path: core_engine/${{ env.ZIP_NAME }}
create-release:
needs: build-and-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set release commit
run: echo "RELEASE_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: Create tag on specific commit
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git tag ${{ github.event.inputs.tag_name }} ${{ env.RELEASE_COMMIT }}
git push origin ${{ github.event.inputs.tag_name }}
- name: Download all build artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.tag_name }}
name: Release ${{ github.event.inputs.tag_name }}
body: ${{ github.event.inputs.release_body }}
files: artifacts/**/*.zip