-
Notifications
You must be signed in to change notification settings - Fork 51
251 lines (229 loc) · 9.17 KB
/
nightly-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
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
name: nightly release
on:
schedule:
- cron: '0 0 * * *' # Run every night at midnight UTC
workflow_dispatch: # This also allows the workflow to be triggered manually
env:
WORKFLOW_URL: https://github.com/maidsafe/safe_network/actions/runs
jobs:
build:
if: ${{ github.repository_owner == 'maidsafe' }}
name: build
environment: stable
env:
FOUNDATION_PK: ${{ vars.FOUNDATION_PK }}
GENESIS_PK: ${{ vars.GENESIS_PK }}
GENESIS_SK: ${{ secrets.GENESIS_SK }}
NETWORK_ROYALTIES_PK: ${{ vars.NETWORK_ROYALTIES_PK }}
PAYMENT_FORWARD_PK: ${{ vars.PAYMENT_FORWARD_PK }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
target: x86_64-pc-windows-msvc
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: ubuntu-latest
target: arm-unknown-linux-musleabi
- os: ubuntu-latest
target: armv7-unknown-linux-musleabihf
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: cargo-bins/cargo-binstall@main
- shell: bash
run: cargo binstall --no-confirm just
- name: build nightly release artifacts
shell: bash
run: |
just build-release-artifacts "${{ matrix.target }}" "true"
- uses: actions/upload-artifact@main
with:
name: safe_network-${{ matrix.target }}
path: |
artifacts
!artifacts/.cargo-lock
- name: post notification to slack on failure
if: ${{ failure() }}
uses: bryannice/[email protected]
env:
SLACK_INCOMING_WEBHOOK: ${{ secrets.SLACK_GH_ACTIONS_WEBHOOK_URL }}
SLACK_MESSAGE: "Please check the logs for the run at ${{ env.WORKFLOW_URL }}/${{ github.run_id }}"
SLACK_TITLE: "Release Failed"
s3-release:
if: ${{ github.repository_owner == 'maidsafe' }}
name: s3 release
runs-on: ubuntu-latest
needs: [build]
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_DEPLOY_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_DEPLOY_AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: eu-west-2
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@master
with:
name: safe_network-x86_64-pc-windows-msvc
path: artifacts/x86_64-pc-windows-msvc/release
- uses: actions/download-artifact@master
with:
name: safe_network-x86_64-unknown-linux-musl
path: artifacts/x86_64-unknown-linux-musl/release
- uses: actions/download-artifact@master
with:
name: safe_network-x86_64-apple-darwin
path: artifacts/x86_64-apple-darwin/release
- uses: actions/download-artifact@master
with:
name: safe_network-aarch64-apple-darwin
path: artifacts/aarch64-apple-darwin/release
- uses: actions/download-artifact@master
with:
name: safe_network-arm-unknown-linux-musleabi
path: artifacts/arm-unknown-linux-musleabi/release
- uses: actions/download-artifact@master
with:
name: safe_network-armv7-unknown-linux-musleabihf
path: artifacts/armv7-unknown-linux-musleabihf/release
- uses: actions/download-artifact@master
with:
name: safe_network-aarch64-unknown-linux-musl
path: artifacts/aarch64-unknown-linux-musl/release
- uses: cargo-bins/cargo-binstall@main
- name: install just
shell: bash
run: cargo binstall --no-confirm just
- name: remove latest nightly release
shell: bash
run: |
just delete-s3-bin "faucet" "nightly"
just delete-s3-bin "nat-detection" "nightly"
just delete-s3-bin "node-launchpad" "nightly"
just delete-s3-bin "safe" "nightly"
just delete-s3-bin "safenode" "nightly"
just delete-s3-bin "safenode_rpc_client" "nightly"
just delete-s3-bin "safenode-manager" "nightly"
just delete-s3-bin "safenodemand" "nightly"
just delete-s3-bin "sn_auditor" "nightly"
- name: upload binaries to S3
shell: bash
run: |
version=$(date +"%Y.%m.%d")
just package-bin "faucet" "$version"
just package-bin "nat-detection" "$version"
just package-bin "node-launchpad" "$version"
just package-bin "safe" "$version"
just package-bin "safenode" "$version"
just package-bin "safenode_rpc_client" "$version"
just package-bin "safenode-manager" "$version"
just package-bin "safenodemand" "$version"
just package-bin "sn_auditor" "$version"
just upload-all-packaged-bins-to-s3
rm -rf packaged_bins
just package-bin "faucet" "nightly"
just package-bin "nat-detection" "nightly"
just package-bin "node-launchpad" "nightly"
just package-bin "safe" "nightly"
just package-bin "safenode" "nightly"
just package-bin "safenode_rpc_client" "nightly"
just package-bin "safenode-manager" "nightly"
just package-bin "safenodemand" "nightly"
just package-bin "sn_auditor" "nightly"
just upload-all-packaged-bins-to-s3
github-release:
if: ${{ github.repository_owner == 'maidsafe' }}
name: github release
runs-on: ubuntu-latest
needs: [s3-release]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@master
with:
name: safe_network-x86_64-pc-windows-msvc
path: artifacts/x86_64-pc-windows-msvc/release
- uses: actions/download-artifact@master
with:
name: safe_network-x86_64-unknown-linux-musl
path: artifacts/x86_64-unknown-linux-musl/release
- uses: actions/download-artifact@master
with:
name: safe_network-x86_64-apple-darwin
path: artifacts/x86_64-apple-darwin/release
- uses: actions/download-artifact@master
with:
name: safe_network-aarch64-apple-darwin
path: artifacts/aarch64-apple-darwin/release
- uses: actions/download-artifact@master
with:
name: safe_network-arm-unknown-linux-musleabi
path: artifacts/arm-unknown-linux-musleabi/release
- uses: actions/download-artifact@master
with:
name: safe_network-armv7-unknown-linux-musleabihf
path: artifacts/armv7-unknown-linux-musleabihf/release
- uses: actions/download-artifact@master
with:
name: safe_network-aarch64-unknown-linux-musl
path: artifacts/aarch64-unknown-linux-musl/release
- uses: cargo-bins/cargo-binstall@main
- name: install just
shell: bash
run: cargo binstall --no-confirm just
- name: set package version
shell: bash
run: |
version=$(date +"%Y.%m.%d")
echo "PACKAGE_VERSION=$version" >> $GITHUB_ENV
- name: package release artifacts
shell: bash
run: just package-all-architectures
- name: delete existing nightly release
env:
GITHUB_TOKEN: ${{ secrets.VERSION_BUMP_COMMIT_PAT }}
run: |
releases=$(gh api repos/${{ github.repository }}/releases --paginate)
echo "$releases" | jq -c '.[]' | while read release; do
tag_name=$(echo $release | jq -r '.tag_name')
release_id=$(echo $release | jq -r '.id')
if [[ $tag_name == nightly* ]]; then
echo "deleting nightly release $tag_name"
gh api -X DELETE repos/${{ github.repository }}/releases/$release_id
exit 0
fi
done
- name: create new nightly release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.VERSION_BUMP_COMMIT_PAT }}
with:
tag_name: nightly-${{ env.PACKAGE_VERSION }}
release_name: "${{ env.PACKAGE_VERSION }} Nightly Release"
body: |
Nightly release of the Autonomi binary set, built from the `main` branch.
These binaries should be compatible with the stable network, but they should be considered experimental.
For the most reliable experience, prefer the latest stable release.
draft: false
prerelease: true
- name: upload artifacts as assets
env:
GITHUB_TOKEN: ${{ secrets.VERSION_BUMP_COMMIT_PAT }}
shell: bash
run: |
(
cd packaged_architectures
ls | xargs gh release upload nightly-${{ env.PACKAGE_VERSION }}
)
- name: post notification to slack on failure
if: ${{ failure() }}
uses: bryannice/[email protected]
env:
SLACK_INCOMING_WEBHOOK: ${{ secrets.SLACK_GH_ACTIONS_WEBHOOK_URL }}
SLACK_MESSAGE: "Please check the logs for the run at ${{ env.WORKFLOW_URL }}/${{ github.run_id }}"
SLACK_TITLE: "Nightly Release Failed"