-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (74 loc) · 2.1 KB
/
Go Build and Release and Clean.yml
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
name: Go Build and Release and Clean
on:
push:
branches:
- main
- master
paths-ignore:
- 'docs/**'
- '.github/**'
- '**.md'
- 'LICENSE'
pull_request:
branches:
- main
- master
paths-ignore:
- 'docs/**'
- '.github/**'
- '**.md'
- 'LICENSE'
workflow_dispatch:
inputs:
tag:
description: 'tag'
required: false
default: 'latest'
# use ${{ github.event.inputs.tag }}
jobs:
job1:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup golang
uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Remove old Releases
uses: dev-drprasad/[email protected]
with:
keep_latest: 0
delete_tags: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build
run: |
# 编译gobd
git clone https://github.com/gek64/gobd.git
cd gobd
go build -o "${{ github.workspace }}/gobd_runner"
chmod +x "${{ github.workspace }}/gobd_runner"
# 编译程序
cd ${{ github.workspace }}
# 获取版本信息
echo "VERSION=$(go run . -v)" >> $GITHUB_ENV
# 批量编译
go mod tidy
"${{ github.workspace }}/gobd_runner" -main -d bin -no_debug -no_cgo
"${{ github.workspace }}/gobd_runner" -os linux -arch mipsle -n ${{ github.event.repository.name }}-softfloat -d bin -no_debug -no_cgo -envs 'GOMIPS=softfloat'
# 获取sha256 checksum
sha256sum bin/* > bin/SHA256SUMS.txt
- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: "bin/*"
tag: ${{ env.VERSION }}
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
removeArtifacts: true
replacesArtifacts: true
- name: Remove old artifacts
uses: c-hive/gha-remove-artifacts@v1
with:
age: "0s"