Skip to content

Commit 7778326

Browse files
committed
CI: refine deploy wasm logic
1 parent d69cca2 commit 7778326

File tree

1 file changed

+26
-28
lines changed

1 file changed

+26
-28
lines changed

.github/workflows/deploy-wasm.yml

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ on:
1010
branches:
1111
- master
1212
repository_dispatch: # listening to rv32emu-prebuilt events
13-
types: [deploy_wasm]
13+
types: [deploy_wasm, deploy_system_wasm]
1414

1515
jobs:
1616
wasm-system-deploy:
1717
if: github.event.pull_request.merged == true ||
1818
github.event_name == 'workflow_dispatch' ||
19-
github.event_name == 'repository_dispatch'
19+
github.event_name == 'repository_dispatch' && github.event.action == 'deploy_system_wasm'
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Check out the repo
@@ -43,7 +43,7 @@ jobs:
4343
- name: install emcc
4444
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
4545
github.event_name == 'workflow_dispatch' ||
46-
github.event_name == 'repository_dispatch' }}
46+
(github.event_name == 'repository_dispatch' && github.event.action == 'deploy_system_wasm') }}
4747
run: |
4848
git clone https://github.com/emscripten-core/emsdk.git
4949
cd emsdk
@@ -58,16 +58,16 @@ jobs:
5858
run: |
5959
make artifact
6060
# Hack Cloudflare 403 Forbidden on GitHub Runner for Doom artifact download
61-
wget --header="User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0" \
62-
--header="Referer: https://www.doomworld.com/" \
63-
--header="Accept-Language: en-US,en;q=0.9" \
64-
-O build/shareware_doom_iwad.zip \
65-
"https://www.doomworld.com/3ddownloads/ports/shareware_doom_iwad.zip"
61+
#wget --header="User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0" \
62+
# --header="Referer: https://www.doomworld.com/" \
63+
# --header="Accept-Language: en-US,en;q=0.9" \
64+
# -O build/shareware_doom_iwad.zip \
65+
# "https://www.doomworld.com/3ddownloads/ports/shareware_doom_iwad.zip"
6666
unzip -d build/ build/shareware_doom_iwad.zip
6767
- name: build with emcc and move application files to /tmp
6868
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
6969
github.event_name == 'workflow_dispatch' ||
70-
github.event_name == 'repository_dispatch' }}
70+
(github.event_name == 'repository_dispatch' && github.event.action == 'deploy_system_wasm') }}
7171
run: |
7272
make CC=emcc ENABLE_SYSTEM=1 ENABLE_SDL=1 INITRD_SIZE=32 -j
7373
mkdir /tmp/rv32emu-system-demo
@@ -80,15 +80,15 @@ jobs:
8080
- name: Check out the rv32emu-system-demo repo
8181
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
8282
github.event_name == 'workflow_dispatch' ||
83-
github.event_name == 'repository_dispatch' }}
83+
(github.event_name == 'repository_dispatch' && github.event.action == 'deploy_system_wasm') }}
8484
uses: actions/checkout@v4
8585
with:
8686
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
8787
repository: sysprog21/rv32emu-demo
8888
- name: Create local changes
8989
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
9090
github.event_name == 'workflow_dispatch' ||
91-
github.event_name == 'repository_dispatch' }}
91+
(github.event_name == 'repository_dispatch' && github.event.action == 'deploy_system_wasm') }}
9292
run: |
9393
mkdir -p system
9494
mv /tmp/rv32emu-system-demo/index.html ./system
@@ -99,7 +99,7 @@ jobs:
9999
- name: Commit files
100100
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
101101
github.event_name == 'workflow_dispatch' ||
102-
github.event_name == 'repository_dispatch' }}
102+
(github.event_name == 'repository_dispatch' && github.event.action == 'deploy_system_wasm') }}
103103
run: |
104104
git config --local user.email "github-actions[bot]@users.noreply.github.com"
105105
git config --local user.name "github-actions[bot]"
@@ -108,17 +108,15 @@ jobs:
108108
- name: Push changes
109109
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
110110
github.event_name == 'workflow_dispatch' ||
111-
github.event_name == 'repository_dispatch' }}
111+
(github.event_name == 'repository_dispatch' && github.event.action == 'deploy_system_wasm') }}
112112
uses: ad-m/github-push-action@master
113113
with:
114114
repository: sysprog21/rv32emu-demo
115115
github_token: ${{ secrets.RV32EMU_DEMO_TOKEN }}
116116
branch: main
117117
wasm-user-deploy:
118-
needs: wasm-system-deploy # to run jobs sequentially
119-
if: github.event.pull_request.merged == true ||
120-
github.event_name == 'workflow_dispatch' ||
121-
github.event_name == 'repository_dispatch'
118+
needs: wasm-system-deploy # to run jobs sequentially since two jobs operate on same reposity: rv32emu-demo
119+
if: always() # ensures wasm-user-deploy runs regardless of the outcome or condition of wasm-system-deploy
122120
runs-on: ubuntu-latest
123121
steps:
124122
- name: Check out the repo
@@ -141,7 +139,7 @@ jobs:
141139
- name: install emcc
142140
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
143141
github.event_name == 'workflow_dispatch' ||
144-
github.event_name == 'repository_dispatch' }}
142+
(github.event_name == 'repository_dispatch' && github.event.action == 'deploy_wasm') }}
145143
run: |
146144
git clone https://github.com/emscripten-core/emsdk.git
147145
cd emsdk
@@ -156,16 +154,16 @@ jobs:
156154
run: |
157155
make artifact
158156
# Hack Cloudflare 403 Forbidden on GitHub Runner for Doom artifact download
159-
wget --header="User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0" \
160-
--header="Referer: https://www.doomworld.com/" \
161-
--header="Accept-Language: en-US,en;q=0.9" \
162-
-O build/shareware_doom_iwad.zip \
163-
"https://www.doomworld.com/3ddownloads/ports/shareware_doom_iwad.zip"
157+
#wget --header="User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:122.0) Gecko/20100101 Firefox/122.0" \
158+
# --header="Referer: https://www.doomworld.com/" \
159+
# --header="Accept-Language: en-US,en;q=0.9" \
160+
# -O build/shareware_doom_iwad.zip \
161+
# "https://www.doomworld.com/3ddownloads/ports/shareware_doom_iwad.zip"
164162
unzip -d build/ build/shareware_doom_iwad.zip
165163
- name: build with emcc and move application files to /tmp
166164
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
167165
github.event_name == 'workflow_dispatch' ||
168-
github.event_name == 'repository_dispatch' }}
166+
(github.event_name == 'repository_dispatch' && github.event.action == 'deploy_wasm') }}
169167
run: |
170168
make CC=emcc ENABLE_SDL=1
171169
mkdir /tmp/rv32emu-demo
@@ -179,15 +177,15 @@ jobs:
179177
- name: Check out the rv32emu-demo repo
180178
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
181179
github.event_name == 'workflow_dispatch' ||
182-
github.event_name == 'repository_dispatch' }}
180+
(github.event_name == 'repository_dispatch' && github.event.action == 'deploy_wasm') }}
183181
uses: actions/checkout@v4
184182
with:
185183
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
186184
repository: sysprog21/rv32emu-demo
187185
- name: Create local changes
188186
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
189187
github.event_name == 'workflow_dispatch' ||
190-
github.event_name == 'repository_dispatch' }}
188+
(github.event_name == 'repository_dispatch' && github.event.action == 'deploy_wasm') }}
191189
run: |
192190
mv /tmp/rv32emu-demo/index.html .
193191
mv /tmp/rv32emu-demo/coi-serviceworker.min.js .
@@ -198,7 +196,7 @@ jobs:
198196
- name: Commit files
199197
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
200198
github.event_name == 'workflow_dispatch' ||
201-
github.event_name == 'repository_dispatch' }}
199+
(github.event_name == 'repository_dispatch' && github.event.action == 'deploy_wasm') }}
202200
run: |
203201
git config --local user.email "github-actions[bot]@users.noreply.github.com"
204202
git config --local user.name "github-actions[bot]"
@@ -207,7 +205,7 @@ jobs:
207205
- name: Push changes
208206
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
209207
github.event_name == 'workflow_dispatch' ||
210-
github.event_name == 'repository_dispatch' }}
208+
(github.event_name == 'repository_dispatch' && github.event.action == 'deploy_wasm') }}
211209
uses: ad-m/github-push-action@master
212210
with:
213211
repository: sysprog21/rv32emu-demo

0 commit comments

Comments
 (0)