Start Site #30
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Start Site | |
on: | |
workflow_dispatch: | |
inputs: | |
checkout_ref: | |
description: "Checkout reference of Xcratch" | |
default: "xcratch-published" | |
required: true | |
dev: | |
description: "Publish for development" | |
type: boolean | |
default: true | |
required: true | |
jobs: | |
build-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Inputs | |
run: echo "${{ toJSON(inputs) }}" | |
- name: checkout scratch-gui | |
uses: actions/checkout@v4 | |
with: | |
repository: xcratch/scratch-gui | |
ref: ${{ inputs.checkout_ref }} | |
path: ./scratch-gui | |
- name: setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ./scratch-gui/.nvmrc | |
- run: npm ci | |
working-directory: ./scratch-gui | |
- name: checkout xcratch.github.io | |
uses: actions/checkout@v4 | |
with: | |
repository: xcratch/xcratch.github.io | |
path: ./xcratch.github.io | |
- run: node ./scripts/replace-logo.js ../scratch-gui | |
working-directory: ./xcratch.github.io | |
- run: node ./scripts/original-assets.js ../scratch-gui | |
working-directory: ./xcratch.github.io | |
- name: build scratch-gui | |
run: npm run build | |
working-directory: ./scratch-gui | |
- run: cp ./xcratch.github.io/editor/favicon.ico ./scratch-gui/build/static/favicon.ico | |
- run: mv -T ./xcratch.github.io/public ./public | |
- run: mv -T ./scratch-gui/build ./public/editor | |
- name: checkout xcratch-doc | |
uses: actions/checkout@v4 | |
with: | |
repository: xcratch/xcratch-doc | |
path: ./xcratch-doc | |
- run: mv -T ./xcratch-doc/docs ./public/docs | |
- name: publish for dev | |
if: ${{ inputs.dev }} | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
destination_dir: ./dev | |
keep_files: false | |
- name: publish | |
if: ${{ !inputs.dev }} | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
destination_dir: . | |
keep_files: true |