-
Notifications
You must be signed in to change notification settings - Fork 6
238 lines (196 loc) · 6.52 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
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
name: "release"
on:
push:
branches:
- "master"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release-created: ${{ steps.release.outputs['release_created'] }}
tag-name: ${{ steps.release.outputs['tag_name'] }}
version: ${{ steps.release.outputs['version'] }}
pr: ${{ steps.release.outputs['pr'] }}
steps:
- name: Run release-please
id: release
uses: google-github-actions/release-please-action@v3
with:
token: ${{ secrets.FLUENCEBOT_RELEASE_PLEASE_PAT }}
command: manifest
config-file: .github/release-please/config.json
manifest-file: .github/release-please/manifest.json
- name: Show output from release-please
if: steps.release.outputs.releases_created
env:
RELEASE_PLEASE_OUTPUT: ${{ toJSON(steps.release.outputs) }}
run: echo "${RELEASE_PLEASE_OUTPUT}" | jq
bump-version:
if: needs.release-please.outputs.pr != null
runs-on: builder
needs:
- release-please
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ fromJson(needs.release-please.outputs.pr).headBranchName }}
- name: Get version
id: version
run: |
version="$(jq -r '.[]' .github/release-please/manifest.json)"
echo "version=${version}" >> $GITHUB_OUTPUT
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install cargo-edit
uses: baptiste0928/[email protected]
with:
crate: cargo-edit
version: v0.12.1
- name: Set version in service
working-directory: service
run: cargo set-version ${{ steps.version.outputs.version }}
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "18"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "aqua/package-lock.json"
cache: "npm"
- name: Set version in aqua
working-directory: aqua
run: npm version ${{ steps.version.outputs.version }}
- name: Commit version bump
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "chore: Bump aqua-ipfs version to ${{ steps.version.outputs.version }}"
branch: ${{ fromJson(needs.release-please.outputs.pr).headBranchName }}
commit_user_name: fluencebot
commit_user_email: [email protected]
commit_author: fluencebot <[email protected]>
aqua-ipfs:
runs-on: builder
needs: release-please
if: needs.release-please.outputs.release-created
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Import secrets
uses: hashicorp/[email protected]
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/npmjs/fluencebot token | NODE_AUTH_TOKEN ;
kv/crates.io/fluencebot token | CARGO_REGISTRY_TOKEN
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install cargo-workspaces
uses: baptiste0928/[email protected]
with:
crate: cargo-workspaces
version: v0.2.44
- name: Setup marine
uses: fluencelabs/setup-marine@v1
- name: Build service
run: ./build.sh
working-directory: service
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "18"
registry-url: "https://registry.npmjs.org"
cache-dependency-path: "aqua/package-lock.json"
cache: "npm"
- name: Setup fcli
uses: fluencelabs/setup-fluence@v1
with:
version: stable
- run: npm ci
working-directory: aqua
- run: npm run build
working-directory: aqua
- name: Publish to NPM registry
run: npm publish --access public
working-directory: aqua
continue-on-error: true
- name: Publish to crates.io
working-directory: ./service
continue-on-error: true
run: |
cargo ws publish \
--no-git-commit \
--allow-dirty \
--from-git \
--skip-published \
--yes
- name: Install ipfs
uses: nahsi/setup-ipfs@v1
- name: Create builtin distribution package
run: ./builtin-package/package.sh
- name: Calculate SHA256
id: sha
run: |
# Calculate sha256
du -hs aqua-ipfs.tar.gz
sha256sum aqua-ipfs.tar.gz
sha=($(sha256sum aqua-ipfs.tar.gz))
echo "sha256=${sha}" >> $GITHUB_OUTPUT
- name: Upload aqua-ipfs package
if: needs.release-please.outputs.release-created
uses: softprops/action-gh-release@v1
with:
files: aqua-ipfs.tar.gz
tag_name: ${{ needs.release-please.outputs.tag-name }}
slack:
if: always()
name: "Notify"
runs-on: ubuntu-latest
needs:
- release-please
- aqua-ipfs
permissions:
contents: read
id-token: write
steps:
- uses: lwhiteley/dependent-jobs-result-check@v1
id: status
with:
statuses: failure
dependencies: ${{ toJSON(needs) }}
- name: Log output
run: |
echo "statuses:" "${{ steps.status.outputs.statuses }}"
echo "jobs:" "${{ steps.status.outputs.jobs }}"
echo "found any?:" "${{ steps.status.outputs.found }}"
- name: Import secrets
uses: hashicorp/[email protected]
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/slack/release-please webhook | SLACK_WEBHOOK_URL
- uses: ravsamhq/notify-slack-action@v2
if: steps.status.outputs.found == 'true'
with:
status: "failure"
notification_title: "*{workflow}* has {status_message}"
message_format: "${{ steps.status.outputs.jobs }} {status_message} in <{repo_url}|{repo}>"
footer: "<{run_url}>"