-
Notifications
You must be signed in to change notification settings - Fork 7
163 lines (137 loc) · 4.74 KB
/
build-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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Go
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# label:
# types: [ created ]
jobs:
build:
strategy:
matrix:
os: [ windows-latest, ubuntu-20.04, macos-12, macos-14 ]
runs-on: ${{ matrix.os }}
name: Build on ${{ matrix.os }}
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ^1.22
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Build on ${{ runner.os }}
run: go env && make jssh
- name: List files
run: ls -Rl release
if: ${{ runner.os != 'Windows' }}
- name: Accidentally upload to the same artifact via multiple jobs
uses: actions/upload-artifact@v4
if: ${{ runner.os != 'macOS' }}
with:
name: artifact-${{ matrix.os }}
path: ./release/*.tar.gz
- name: Accidentally upload to the same artifact via multiple jobs
uses: actions/upload-artifact@v4
if: ${{ runner.os == 'macOS' }}
with:
name: artifact-${{ matrix.os }}
path: ./release/*.zip
build_linux_other_platforms:
runs-on: ubuntu-latest
name: Build on Linux other platforms
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64,riscv64
- name: Set up Go 1.x
uses: actions/setup-go@v5
with:
go-version: ^1.22
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Prepare build
run: |
make jsbuiltin
- name: Build on Linux arm64
run: |
docker run --platform=arm64 --rm -v $(pwd):$(pwd) -w $(pwd) golang bash -c "git config --global --add safe.directory /home/runner/work/jssh/jssh && go env && make jssh-only"
- name: List files
run: ls -Rl release
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: artifact-linux-arm64
path: ./release/*.tar.gz
release:
runs-on: ubuntu-latest
name: Release
needs: [ build, build_linux_other_platforms ]
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: artifact
pattern: artifact-*
- name: Download artifact
uses: actions/download-artifact@v4
with:
path: .
- name: List files
run: ls -Rl
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: current
release_name: Build from commit ${{ github.sha }}
draft: true
prerelease: true
- name: Upload Release Asset for Windows AMD64 version
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifact/jssh-windows-amd64.tar.gz
asset_name: jssh-windows-amd64.tar.gz
asset_content_type: application/x-gzip
- name: Upload Release Asset for Linux AMD64 version
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifact/jssh-linux-amd64.tar.gz
asset_name: jssh-linux-amd64.tar.gz
asset_content_type: application/x-gzip
- name: Upload Release Asset for Linux ARM64 version
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifact/jssh-linux-arm64.tar.gz
asset_name: jssh-linux-arm64.tar.gz
asset_content_type: application/x-gzip
- name: Upload Release Asset for macOS AMD64 version
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifact/jssh-darwin-amd64.zip
asset_name: jssh-darwin-amd64.zip
asset_content_type: application/zip
- name: Upload Release Asset for macOS ARM64 version
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifact/jssh-darwin-arm64.zip
asset_name: jssh-darwin-arm64.zip
asset_content_type: application/zip