-
-
Notifications
You must be signed in to change notification settings - Fork 4
65 lines (64 loc) · 2.13 KB
/
bundle.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
name: Bundle Stack-chan Firmware
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Check for changes in firmware
id: diff_check
run: |
git diff --quiet HEAD^ HEAD -- ./firmware/ || echo "::set-output name=diff_detected::true"
- name: Cache build results
id: cache
uses: actions/cache@v2
with:
path: ./firmware/stackchan/tech.moddable.stackchan
key: ${{ github.sha }}
- name: Setup
if: steps.diff_check.outputs.diff_detected || steps.cache.outputs.cache-hit != 'true'
uses: ./.github/actions/setup
- name: Bundle
if: steps.diff_check.outputs.diff_detected || steps.cache.outputs.cache-hit != 'true'
run: source $HOME/.local/share/xs-dev-export.sh && npm run bundle
working-directory: ./firmware
- name: Upload Firmware Bundle
if: steps.diff_check.outputs.diff_detected || steps.cache.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v2
with:
name: firmware-bundle
path: ./firmware/stackchan/tech.moddable.stackchan
deploy:
needs: build
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout Pages Branch
uses: actions/checkout@v3
with:
ref: gh-pages
- name: Download Firmware Bundle
uses: actions/download-artifact@v2
with:
name: firmware-bundle
path: ./firmware-bundle
- name: Move Bundle
run: |
mkdir -p ./web/flash/tech.moddable.stackchan
rm -rf ./web/flash/tech.moddable.stackchan/*
mv firmware-bundle/* ./web/flash/tech.moddable.stackchan
- name: Commit and Push
run: |
git config --global user.name 'GitHub Action'
git config --global user.email '[email protected]'
git add .
git commit -m "Deploy firmware bundle from ${{ github.sha }}"
git push