Skip to content

Commit a09ca99

Browse files
authored
Merge pull request #603 from ChinYikMing/ci-wasm-commit-on-change
CI: Push wasm commit on changes only
2 parents b6aa3ca + f8fd4f3 commit a09ca99

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

.github/workflows/deploy-wasm.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,22 @@ jobs:
9292
mv /tmp/rv32emu-system-demo/rv32emu.wasm ./system
9393
mv /tmp/rv32emu-system-demo/rv32emu.worker.js ./system
9494
- name: Commit files
95+
id: commit
9596
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
9697
github.event_name == 'workflow_dispatch' ||
9798
(github.event_name == 'repository_dispatch' && github.event.action == 'deploy_system_wasm') }}
9899
run: |
99100
git config --local user.email "github-actions[bot]@users.noreply.github.com"
100101
git config --local user.name "github-actions[bot]"
101102
git add system/
102-
git commit -m "Add changes to system emulation"
103+
if git diff --cached --quiet; then
104+
echo "committed=false" >> $GITHUB_OUTPUT
105+
else
106+
git commit -m "Add changes to system emulation"
107+
echo "committed=true" >> $GITHUB_OUTPUT
108+
fi
103109
- name: Push changes
104-
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
105-
github.event_name == 'workflow_dispatch' ||
106-
(github.event_name == 'repository_dispatch' && github.event.action == 'deploy_system_wasm') }}
110+
if: steps.commit.outputs.committed == 'true'
107111
uses: ad-m/github-push-action@master
108112
with:
109113
repository: sysprog21/rv32emu-demo
@@ -184,18 +188,22 @@ jobs:
184188
mv /tmp/rv32emu-demo/rv32emu.wasm .
185189
mv /tmp/rv32emu-demo/rv32emu.worker.js .
186190
- name: Commit files
191+
id: commit
187192
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
188193
github.event_name == 'workflow_dispatch' ||
189194
(github.event_name == 'repository_dispatch' && github.event.action == 'deploy_user_wasm') }}
190195
run: |
191196
git config --local user.email "github-actions[bot]@users.noreply.github.com"
192197
git config --local user.name "github-actions[bot]"
193198
git add --all
194-
git commit -m "Add changes to user emulation"
199+
if git diff --cached --quiet; then
200+
echo "committed=false" >> $GITHUB_OUTPUT
201+
else
202+
git commit -m "Add changes to user emulation"
203+
echo "committed=true" >> $GITHUB_OUTPUT
204+
fi
195205
- name: Push changes
196-
if: ${{ steps.changed-files.outputs.any_modified == 'true' ||
197-
github.event_name == 'workflow_dispatch' ||
198-
(github.event_name == 'repository_dispatch' && github.event.action == 'deploy_user_wasm') }}
206+
if: steps.commit.outputs.committed == 'true'
199207
uses: ad-m/github-push-action@master
200208
with:
201209
repository: sysprog21/rv32emu-demo

0 commit comments

Comments
 (0)