-
Notifications
You must be signed in to change notification settings - Fork 37
202 lines (174 loc) · 7.32 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
name: Release
on:
workflow_dispatch:
inputs:
release-version:
required: true
signing-key-id:
required: true
type: string
default: C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0
jobs:
create-branch-prefix:
uses: ./.github/workflows/create_branch_prefix.yml
with:
prefix: 'release'
version: ${{ inputs.release-version }}
signing-key-id: ${{ inputs.signing-key-id }}
secrets:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
prepare-release:
name: Prepare Release
needs:
- create-branch-prefix
runs-on: ubuntu-latest
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
release-version: ${{ inputs.release-version }}
test-infos: ${{ steps.get-test-infos.outputs.test-infos }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.create-branch-prefix.outputs.base-branch }}
token: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
- uses: ./.github/actions/setup_node
with:
registry-url: https://registry.npmjs.org
node-auth-token: ${{ secrets.NPM_TOKEN }}
- uses: ./.github/actions/setup_dfx
- run: npm install
- name: Install global dependencies
run: |
AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic
- name: Update version and build templates
run: |
VERSION=${{ inputs.release-version }}
sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" package.json
sed -E -i "s/(\"version\": \")(.*)(\")/\1$VERSION\3/" dfx_extension/extension.json
npm install
- name: Build stable template
run: AZLE_VERBOSE=true npx azle template
- name: Build experimental template
run: AZLE_VERBOSE=true npx azle template --experimental
- uses: ./.github/actions/commit_and_push
with:
branch-name: ${{ needs.create-branch-prefix.outputs.base-branch }}
commit-message: 'Prepare release ${{ inputs.release-version }}'
gpg-signing-key: ${{ secrets.GPG_SIGNING_KEY }}
signing-key-id: ${{ inputs.signing-key-id }}
- name: Publish to npm
run: |
if [[ "${{ inputs.release-version }}" == *"-rc."* ]]; then
npm publish --tag next
else
npm publish
fi
- id: get-test-infos
uses: ./.github/actions/get_test_infos
with:
directories: ./examples
update-test-files-for-release-commit:
needs:
- prepare-release
- create-branch-prefix
name: Update ${{ matrix.test.name }} files for release commit
runs-on: ubuntu-latest
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
test: ${{ fromJson(needs.prepare-release.outputs.test-infos) }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.create-branch-prefix.outputs.base-branch }}
token: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
- uses: ./.github/actions/setup_node
- uses: ./.github/actions/setup_dfx
- run: npm install
- name: Update azle version
working-directory: ${{ matrix.test.path }}
run: |
sed -E -i "s/(\"azle\": \")(.*)(\")/\1${{ inputs.release-version }}\3/" package.json
- run: npm install
working-directory: ${{ matrix.test.path }}
- name: Start dfx with artificial delay 0
working-directory: ${{ matrix.test.path }}
run: dfx start --clean --background --host 127.0.0.1:8000 --artificial-delay 0
- name: Run dfx deploy
working-directory: ${{ matrix.test.path }}
run: dfx deploy
- name: Create branch name
id: create-branch-name
uses: ./.github/actions/create_branch_name
with:
prefix: ${{ needs.create-branch-prefix.outputs.branch-prefix }}
path: ${{ matrix.test.displayPath }}
- uses: ./.github/actions/commit_and_push
with:
branch-name: ${{ steps.create-branch-name.outputs.branch-name }}
commit-message: 'Update test files for ${{ matrix.test.displayPath }}'
gpg-signing-key: ${{ secrets.GPG_SIGNING_KEY }}
create-branch: 'true'
signing-key-id: ${{ inputs.signing-key-id }}
squash-branches:
needs:
- prepare-release
- update-test-files-for-release-commit
- create-branch-prefix
uses: ./.github/workflows/squash_branches.yml
with:
base-branch: ${{ needs.create-branch-prefix.outputs.base-branch }}
branch-prefix: ${{ needs.create-branch-prefix.outputs.branch-prefix }}
commit-message: 'Update test files for all tests and examples ${{ inputs.release-version }}'
signing-key-id: ${{ inputs.signing-key-id }}
secrets:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LASTMJS_GITHUB_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
create-release:
needs:
- prepare-release
- squash-branches
name: Create Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
token: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
- name: Create release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=${{ inputs.release-version }}
git tag $VERSION
git push origin $VERSION
if [[ "$VERSION" == *"-rc."* ]]; then
gh release create "$VERSION" -t "$VERSION" --prerelease
else
gh release create "$VERSION" -t "$VERSION"
fi
create-pr:
needs:
- prepare-release
- squash-branches
- create-branch-prefix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.LASTMJS_GITHUB_TOKEN }}
run: |
gh pr create \
--base main \
--head ${{ needs.create-branch-prefix.outputs.base-branch }} \
--title "Release ${{ inputs.release-version }}" \
--body "Automated PR for release ${{ inputs.release-version }}"