forked from linuxkit/linuxkit
-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (83 loc) · 2.31 KB
/
release.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
86
87
88
89
90
91
92
93
94
95
96
97
name: Release Tagged Linuxkit
on:
create:
jobs:
build-all:
name: Build all targets expect macOS
if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.122
uses: actions/setup-go@v5
with:
go-version: 1.22.3
id: go
- name: Check out code
uses: actions/checkout@v4
- name: Set path
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
env:
GOPATH: ${{runner.workspace}}
- name: Build
run: |
make build-targets-linux build-targets-windows
env:
GOPATH: ${{runner.workspace}}
- uses: actions/upload-artifact@v4
with:
name: release-targets-except-cgo
path: bin/
# separate macos build because macos needs CGO, and it is very hard to cross-compile that
build-macos:
name: Build macOS target
if: github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/v')
runs-on: macos-latest
steps:
- name: Set up Go 1.122
uses: actions/setup-go@v5
with:
go-version: 1.22.3
id: go
- name: Check out code
uses: actions/checkout@v4
- name: Set path
run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
env:
GOPATH: ${{runner.workspace}}
- name: Build
run: |
make build-targets-macos
env:
GOPATH: ${{runner.workspace}}
- uses: actions/upload-artifact@v4
with:
name: release-targets-macos
path: bin/
release-artifacts:
needs: [build-all, build-macos]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: release-targets-except-cgo
path: bintmp/release-targets-except-cgo
- uses: actions/download-artifact@v4
with:
name: release-targets-macos
path: bintmp/release-targets-macos
- name: Combine Artifacts
run: |
mkdir -p bin/
cp bintmp/*/* bin/
- name: Checksum Artifacts
run: |
make checksum-targets
- name: GitHub Release
uses: softprops/action-gh-release@1e07f4398721186383de40550babbdf2b84acfc5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
files: bin/*
generate_release_notes: true