-
Notifications
You must be signed in to change notification settings - Fork 37
127 lines (107 loc) · 5.06 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
name: Release
on:
push:
branches:
- main
pull_request: # Runs on pull requests to any branch
jobs:
install-global-dependencies:
name: Test install global dependencies
runs-on: ubutun-latest
steps:
- uses: actions/checkout@v4
- id: get-node-version
uses: ./.github/actions/get_node_version
- uses: actions/setup-node@v4
with:
node-version: ${{ steps.get-node-version.outputs.node-version }}
- name: Install curl
run: sudo apt-get install curl -y
- id: get-dfx-version
uses: ./.github/actions/get_dfx_version
- name: Install dfx
run: |
# Install dfx (Note: DFX must be installed before `npx azle` because the azle instalation process requires dfx)
src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }}
- name: Install global dependencies
run: |
AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH
determine-should-release:
if: ${{ startsWith(github.head_ref, 'release--') }}
name: Determine if this branch should release
runs-on: ubuntu-latest
outputs:
should-release: ${{ steps.determine-should-release.outputs.should-release }}
steps:
- uses: actions/checkout@v4
- id: determine-should-release
uses: ./.github/actions/should_release
get-test-infos:
needs: determine-should-release
if: ${{ startsWith(github.head_ref, 'release--') && needs.determine-should-release.outputs.should-release }}
name: Get test infos
runs-on: ubuntu-latest
outputs:
test-infos: ${{ steps.get-test-infos.outputs.test-infos }}
steps:
- uses: actions/checkout@v4
- id: get-node-version
uses: ./.github/actions/get_node_version
- name: Get all test infos
id: get-test-infos
uses: ./.github/actions/get_test_infos
with:
node-version: ${{ steps.get-node-version.outputs.node-version }}
directories: |
./examples
./tests
release:
name: Deploy release
# Only run this job if it's a release branch. This job will run instead of run-tests and will automatically publish another commit which will be tested
if: ${{ needs.determine-should-release.outputs.should-release == 'true' }}
needs:
- determine-should-release
- get-test-infos
runs-on: ubuntu-latest
env:
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} # All commits must be verified
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref || github.ref }}
token: ${{ secrets.LASTMJS_GITHUB_TOKEN || github.token }}
- id: get-node-version
uses: ./.github/actions/get_node_version
- uses: actions/setup-node@v4
with:
node-version: ${{ steps.get-node-version.outputs.node-version }}
registry-url: https://registry.npmjs.org
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install curl
run: sudo apt-get install curl -y
- id: get-dfx-version
uses: ./.github/actions/get_dfx_version
- name: Install dfx
run: |
# Install dfx (Note: DFX must be installed before `npx azle` because the azle instalation process requires dfx)
src/build/stable/commands/install_global_dependencies/install_dfx.sh ${{ steps.get-dfx-version.outputs.dfx-version }}
- name: Install global dependencies
run: |
AZLE_VERBOSE=true npx azle install-global-dependencies --rust --wasi2ic
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH
# TODO we should use some Action-specific bot account
- name: Configure git for publishing release
run: |
git config --global user.name 'Jordan Last'
git config --global user.email '[email protected]'
git config --global commit.gpgsign true
echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --import
git config --global user.signingkey C8B77BCBE16CD2B94B43F9C8757397B82D4ED7B0
- name: Publish release
run: |
BRANCH_NAME="${{ github.head_ref }}"
RELEASE_VERSION="${BRANCH_NAME:9}"
./.github/scripts/publish_github_action.sh $RELEASE_VERSION ${{ toJSON(needs.get-test-infos.outputs.test-infos) }}