forked from maidsafe/autonomi
-
Notifications
You must be signed in to change notification settings - Fork 0
180 lines (170 loc) · 7.69 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
name: release
# prevent concurrent version bumps + releases from running at the same time
concurrency:
group: "version-bump-release-${{ github.ref }}"
on:
push:
branches:
- main
- alpha*
- beta*
- rc*
env:
RELEASE_PLZ_BIN_URL: https://github.com/MarcoIeni/release-plz/releases/download/release-plz-v0.3.43/release-plz-x86_64-unknown-linux-gnu.tar.gz
JUST_BIN_URL: https://github.com/casey/just/releases/download/1.13.0/just-1.13.0-x86_64-unknown-linux-musl.tar.gz
WORKFLOW_URL: https://github.com/maidsafe/safe_network/actions/runs
jobs:
build:
if: |
github.repository_owner == 'maidsafe' &&
startsWith(github.event.head_commit.message, 'chore(release):')
name: build
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: 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
# It's quite slow to install just by building it, but here we need a cross-platform solution.
- shell: bash
run: cargo install just
- shell: bash
run: just build-release-artifacts "${{ matrix.target }}"
- 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"
release:
if: |
github.repository_owner == 'maidsafe' &&
startsWith(github.event.head_commit.message, 'chore(release):')
name: publish and 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
GH_TOKEN: ${{ secrets.VERSION_BUMP_COMMIT_PAT }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: "0"
token: ${{ secrets.VERSION_BUMP_COMMIT_PAT }}
- 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-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
- shell: bash
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
# It's possible to `cargo install` these tools, but it's very slow to compile on GHA infra.
# Therefore we just pull some binaries from the Github Releases.
- name: install tools
shell: bash
run: |
curl -L -O $RELEASE_PLZ_BIN_URL
tar xvf release-plz-x86_64-unknown-linux-gnu.tar.gz
rm release-plz-x86_64-unknown-linux-gnu.tar.gz
sudo mv release-plz /usr/local/bin
curl -L -O $JUST_BIN_URL
mkdir just
tar xvf just-1.13.0-x86_64-unknown-linux-musl.tar.gz -C just
rm just-1.13.0-x86_64-unknown-linux-musl.tar.gz
sudo mv just/just /usr/local/bin
rm -rf just
- name: publish and release
shell: bash
run: |
# Package versioned assets as tar.gz and zip archives, and upload them to S3.
#
# This is done before publishing because the node manager relies on these binaries
# existing after the new version of the `sn_node` crate is published. If these binaries
# were uploaded after the publishing process, there could be a significant gap between the
# new version of `sn_node` being published and the new binaries being available for
# download. This could cause errors if node manager users ran the `upgrade` command,
# because the process gets the latest version from `crates.io` then downloads the binaries
# from S3, using that version number. Uploading the binaries to S3 before publishing
# ensures that they will exist after the new crate has been published.
just package-release-assets "safe"
just package-release-assets "safenode"
just package-release-assets "faucet"
just package-release-assets "safenode_rpc_client"
just package-release-assets "safenode-manager"
just package-release-assets "safenodemand"
just upload-release-assets-to-s3 "safe"
just upload-release-assets-to-s3 "safenode"
just upload-release-assets-to-s3 "safenode-manager"
just upload-release-assets-to-s3 "safenodemand"
just upload-release-assets-to-s3 "faucet"
just upload-release-assets-to-s3 "safenode_rpc_client"
# The `release-plz` command publishes crates which had their versions bumped, and also
# creates Github releases. The binaries are then attached to the releases in the
# `upload-github-release-assets` target.
cargo login ${{ secrets.CRATES_IO_TOKEN }}
release-plz release --git-token ${{ secrets.VERSION_BUMP_COMMIT_PAT }}
just upload-github-release-assets
# Now upload the 'latest' versions to S3. This can be done later because the node manager
# does not depend on these existing.
just package-release-assets "safe" "latest"
just package-release-assets "safenode" "latest"
just package-release-assets "faucet" "latest"
just package-release-assets "safenode_rpc_client" "latest"
just package-release-assets "safenode-manager" "latest"
just package-release-assets "safenodemand" "latest"
just upload-release-assets-to-s3 "safe"
just upload-release-assets-to-s3 "safenode"
just upload-release-assets-to-s3 "safenode-manager"
just upload-release-assets-to-s3 "safenodemand"
just upload-release-assets-to-s3 "faucet"
just upload-release-assets-to-s3 "safenode_rpc_client"
- 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"