-
Notifications
You must be signed in to change notification settings - Fork 100
86 lines (84 loc) · 3.3 KB
/
deploy-wasm.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
name: WebAssembly
on:
pull_request_target:
branches:
- master
types:
- closed
workflow_dispatch:
branches:
- master
jobs:
wasm-deploy:
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Verify if the JS or HTML or ELF executable files has been modified
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
assets/html/index.html
assets/js/pre.js
build/*.elf
- name: install emcc
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
github.event_name == 'workflow_dispatch'}}
run: |
git clone https://github.com/emscripten-core/emsdk.git
cd emsdk
git pull
git checkout 3.1.51
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
echo "$PATH" >> $GITHUB_PATH
shell: bash
- name: build with emcc and move application files to /tmp
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
github.event_name == 'workflow_dispatch'}}
run: |
make CC=emcc ENABLE_GDBSTUB=0 ENABLE_SDL=1
mkdir /tmp/rv32emu-demo
mv assets/html/index.html /tmp/rv32emu-demo
mv assets/js/coi-serviceworker.min.js /tmp/rv32emu-demo
mv build/elf_list.js /tmp/rv32emu-demo
mv build/rv32emu.js /tmp/rv32emu-demo
mv build/rv32emu.wasm /tmp/rv32emu-demo
mv build/rv32emu.worker.js /tmp/rv32emu-demo
ls -al /tmp/rv32emu-demo
- name: Check out the rv32emu-demo repo
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
github.event_name == 'workflow_dispatch'}}
uses: actions/checkout@v4
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
repository: sysprog21/rv32emu-demo
- name: Create local changes
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
github.event_name == 'workflow_dispatch'}}
run: |
mv /tmp/rv32emu-demo/index.html .
mv /tmp/rv32emu-demo/coi-serviceworker.min.js .
mv /tmp/rv32emu-demo/elf_list.js .
mv /tmp/rv32emu-demo/rv32emu.js .
mv /tmp/rv32emu-demo/rv32emu.wasm .
mv /tmp/rv32emu-demo/rv32emu.worker.js .
- name: Commit files
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
github.event_name == 'workflow_dispatch'}}
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add --all
git commit -m "Add changes"
- name: Push changes
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
github.event_name == 'workflow_dispatch'}}
uses: ad-m/github-push-action@master
with:
repository: sysprog21/rv32emu-demo
github_token: ${{ secrets.RV32EMU_DEMO_TOKEN }}
branch: main