Skip to content

deployジョブの条件であるpushイベントの対象をmainに変更 #3

deployジョブの条件であるpushイベントの対象をmainに変更

deployジョブの条件であるpushイベントの対象をmainに変更 #3

Workflow file for this run

name: Bundle Stack-chan Firmware
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
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