-
Notifications
You must be signed in to change notification settings - Fork 0
264 lines (225 loc) · 7.38 KB
/
main.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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
name: CI
on:
push:
branches:
- release*
tags:
- v*
- nightly
pull_request:
types: [opened, synchronize, reopened, labeled]
branches:
- main
paths-ignore:
- '**/*.md'
jobs:
build-x86_64:
if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'linux') || github.event_name == 'push'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install
shell: bash
run: scripts/install.sh local-install
- name: Pack
shell: bash
run: scripts/pack.sh home-cli-x86_64.tar
- uses: actions/upload-artifact@v3
with:
name: home-cli-pack-x86_64
path: home-cli-x86_64.tar
run-x86_64:
runs-on: ubuntu-20.04
needs: build-x86_64
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/download-artifact@v3
with:
name: home-cli-pack-x86_64
- name: Unpack
shell: bash
run: scripts/install.sh unpack home-cli-x86_64.tar
build-arm64:
if: github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'linux') || github.event_name == 'push'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: uraimo/run-on-arch-action@v2
name: Run commands
with:
arch: aarch64
distro: ubuntu20.04
# Mount the artifacts directory as /artifacts in the container
dockerRunArgs: |
--volume "${PWD}:/workspace"
env: |
HOMECLI_PRINT_PROGRESS: false
install: |
apt update -y
apt install -y python3 python3-pip curl libfuse-dev git
# Set an output parameter `uname` for use in subsequent steps
run: |
uname -a
cd /workspace
scripts/install.sh local-install
scripts/pack.sh home-cli-arm64.tar
- uses: actions/upload-artifact@v3
with:
name: home-cli-pack-arm64
path: home-cli-arm64.tar
run-arm64:
runs-on: ubuntu-20.04
needs: build-arm64
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/download-artifact@v3
with:
name: home-cli-pack-arm64
- uses: uraimo/run-on-arch-action@v2
name: Run commands
with:
arch: aarch64
distro: ubuntu20.04
env: |
HOMECLI_PRINT_PROGRESS: false
# Mount the artifacts directory as /artifacts in the container
dockerRunArgs: |
--volume "${PWD}:/workspace"
install: |
apt update -y
apt install -y python3 python3-pip curl libfuse-dev git
# Set an output parameter `uname` for use in subsequent steps
run: |
cd /workspace
scripts/install.sh unpack home-cli-arm64.tar
release:
runs-on: ubuntu-20.04
needs:
- run-x86_64
- run-arm64
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- name: Create Release
if: "!contains(github.ref, 'nightly')"
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Delete Legacy Pre-Release
if: "contains(github.ref, 'nightly')"
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: releases } = await github.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo,
});
for (const release of releases) {
if (release.prerelease) {
await github.repos.deleteRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: release.id,
});
}
}
- name: Create Pre-Release
if: contains(github.ref, 'nightly')
id: create_pre_release
uses: actions/create-release@v1
with:
tag_name: ${{ github.ref }}
release_name: Pre-Release
draft: false
prerelease: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/download-artifact@v3
with:
name: home-cli-pack-x86_64
- name: Upload Assets x86_64
if: "!contains(github.ref, 'nightly')"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./home-cli-x86_64.tar
asset_name: home-cli-x86_64.tar
asset_content_type: application/tar
- name: Upload Pre-Release Assets x86_64
if: contains(github.ref, 'nightly')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_pre_release.outputs.upload_url }}
asset_path: ./home-cli-x86_64.tar
asset_name: home-cli-x86_64.tar
asset_content_type: application/tar
- uses: actions/download-artifact@v3
with:
name: home-cli-pack-arm64
- name: Upload Assets arm64
if: "!contains(github.ref, 'nightly')"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./home-cli-arm64.tar
asset_name: home-cli-arm64.tar
asset_content_type: application/tar
- name: Upload Pre-Release Assets arm64
if: contains(github.ref, 'nightly')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_pre_release.outputs.upload_url }}
asset_path: ./home-cli-arm64.tar
asset_name: home-cli-arm64.tar
asset_content_type: application/tar
- name: Upload Assets install.sh
if: "!contains(github.ref, 'nightly')"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./scripts/install.sh
asset_name: install.sh
asset_content_type: text/plain
- name: Upload Pre-Release Assets install.sh
if: "contains(github.ref, 'nightly')"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_pre_release.outputs.upload_url }}
asset_path: ./scripts/install.sh
asset_name: install.sh
asset_content_type: text/plain