-
Notifications
You must be signed in to change notification settings - Fork 13
192 lines (162 loc) · 5.17 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
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
name: Release
on:
release:
types: [released]
jobs:
#####################
# The docker builds #
#####################
# The image shared by all builds, containing pre-built rust deps
docker-build-base:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: sudo apt-get update
# We use buildx and its GitHub Actions caching support `type=gha`. For
# more information, see
# https://github.com/docker/build-push-action/issues/539
- name: Set up docker buildx
uses: docker/setup-buildx-action@v2
- name: Build base Docker image
uses: docker/build-push-action@v3
with:
file: Dockerfile
cache-from: type=gha,scope=cached-stage
cache-to: type=gha,scope=cached-stage,mode=max
outputs: type=cacheonly
target: deps
docker-build:
runs-on: ubuntu-latest
needs: docker-build-base
strategy:
matrix:
include:
- name: console.wasm.gz
target: scratch_console
- name: observatory.wasm.gz
target: scratch_observatory
- name: mission_control.wasm.gz
target: scratch_mission_control
- name: satellite.wasm.gz
target: scratch_satellite
steps:
- uses: actions/checkout@v3
- name: Set up docker buildx
uses: docker/setup-buildx-action@v2
- name: Build ${{ matrix.name }}
uses: docker/build-push-action@v3
with:
file: Dockerfile
cache-from: type=gha,scope=cached-stage
# Exports the artefacts from the final stage
outputs: ./out
target: ${{ matrix.target }}
- run: sha256sum out/${{ matrix.name }}
- run: mv out/${{ matrix.name }} ${{ matrix.name }}
- name: 'Upload ${{ matrix.name }}'
uses: actions/upload-artifact@v3
with:
# name is the name used to display and retrieve the artifact
name: ${{ matrix.name }}
# path is the name used as the file to upload and the name of the
# downloaded file
path: ./${{ matrix.name }}
metadata:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build metadata
run: bash ./docker/metadata
env:
CANISTERS: console,observatory,mission_control,satellite
- name: Upload metadata
uses: actions/upload-artifact@v3
with:
# name is the name used to display and retrieve the artifact
name: metadata.json
# path is the name used as the file to upload and the name of the
# downloaded file
path: ./metadata.json
candid:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- name: console.did
target: console
- name: observatory.did
target: observatory
- name: mission_control.did
target: mission_control
- name: satellite.did
target: satellite
steps:
- uses: actions/checkout@v3
- name: 'Copy ${{ matrix.name }}'
run: bash ./docker/candid
env:
CANISTER: ${{ matrix.target }}
- name: 'Upload ${{ matrix.name }}'
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.name }}
path: ./${{ matrix.name }}
release:
runs-on: ubuntu-latest
needs: ['docker-build', 'metadata', 'candid']
steps:
- uses: actions/checkout@v3
- name: Download console.wasm.gz
uses: actions/download-artifact@v3
with:
name: console.wasm.gz
- name: Download observatory.wasm.gz
uses: actions/download-artifact@v3
with:
name: observatory.wasm.gz
- name: Download mission_control.wasm.gz
uses: actions/download-artifact@v3
with:
name: mission_control.wasm.gz
- name: Download satellite.wasm.gz
uses: actions/download-artifact@v3
with:
name: satellite.wasm.gz
- name: Download console.did
uses: actions/download-artifact@v3
with:
name: console.did
- name: Download observatory.did
uses: actions/download-artifact@v3
with:
name: observatory.did
- name: Download mission_control.did
uses: actions/download-artifact@v3
with:
name: mission_control.did
- name: Download satellite.did
uses: actions/download-artifact@v3
with:
name: satellite.did
- name: Download metadata.json
uses: actions/download-artifact@v3
with:
name: metadata.json
- name: Prepare canisters
run: bash ./docker/prepare
env:
CANISTERS: console,observatory,mission_control,satellite
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
./console*.wasm.gz
./observatory*.wasm.gz
./mission_control*.wasm.gz
./satellite*.wasm.gz
./console*.did
./observatory*.did
./mission_control*.did
./satellite*.did
./metadata.json