v2.1.10 #189
Workflow file for this run
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: Build and publish to npm | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'The branch to checkout' | |
required: false | |
default: 'master' | |
jobs: | |
build_and_release: | |
runs-on: ubuntu-latest | |
env: | |
NODE_OPTIONS: "--max-old-space-size=5120" # locally export NODE_OPTIONS=--max-old-space-size=5120 | |
MBHome: /home/runner/work/MartyBlocks/MartyBlocks | |
mblib: /home/runner/work/MartyBlocks/MartyBlocks/marty-blocks-lib/ | |
REPLACEMENTS: /home/runner/work/MartyBlocks/MartyBlocks/marty-blocks-lib/replacements | |
blocks_original: /home/runner/work/MartyBlocks/MartyBlocks/scratch-blocks | |
vm_original: /home/runner/work/MartyBlocks/MartyBlocks/scratch-vm | |
gui_original: /home/runner/work/MartyBlocks/MartyBlocks/scratch-gui | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.event.inputs.branch || 'master' }} | |
- name: Set up Python 2.7 | |
run: | | |
sudo apt-get update | |
sudo apt-get install python2.7 | |
- name: Link python to python2.7 | |
run: | | |
sudo ln -sf /usr/bin/python2.7 /usr/bin/python | |
- name: Use Node.js 16.15.0 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.15.0 | |
- name: see node version | |
run: node -v | |
- name: see memory allocation | |
run: node -e 'console.log(`node heap limit = ${require("v8").getHeapStatistics().heap_size_limit / (1024 * 1024)} Mb`)' | |
- name: Clone repos | |
run: | | |
git clone -b develop https://github.com/llk/scratch-blocks.git --no-checkout ${{ env.blocks_original }} | |
git clone -b develop https://github.com/llk/scratch-vm.git --no-checkout ${{ env.vm_original }} | |
git clone -b develop https://github.com/llk/scratch-gui.git --no-checkout ${{ env.gui_original }} | |
- name: Checkout appropriate commit | |
run: | | |
cd ${{ env.blocks_original }} && git reset --hard f9107bf5d0479d632658f2b203995f5ae6d75363 | |
cd ${{ env.vm_original }} && git reset --hard 3b36a8e3ea7f3caa5b4bf4ae7b4f821a986a1378 | |
cd ${{ env.gui_original }} && git reset --hard 738c86bb58e336711280aec33c510d7aef79408e | |
- name: Install scratch | |
run: | | |
cd ${{ env.blocks_original }} && npm install | |
cd ${{ env.vm_original }} && npm install && npm install [email protected] | |
cd ${{ env.gui_original }} && npm install && npm i [email protected] && npm install [email protected] && npm install --save-dev babel-plugin-prismjs | |
- name: Install marty blocks library | |
run: | | |
cd ${{ env.mblib }} | |
npm install | |
- name: setting production environments | |
run: | | |
cd ${{ env.mblib }} | |
npx node set-production.js | |
- name: Link repositories | |
run: | | |
cd ${{ env.mblib }} && npm link | |
cd ${{ env.blocks_original }} && npm link && npm link marty-blocks-lib | |
cd ${{ env.vm_original }} && npm link && npm link marty-blocks-lib scratch-blocks | |
cd ${{ env.gui_original }} && npm link marty-blocks-lib scratch-blocks scratch-vm | |
- name: Copy marty-machine web workder | |
run: | | |
cp ${{ env.mblib }}/node_modules/@robotical/marty-machine-lib/dist/assets/* ${{ env.gui_original }}/static | |
- name: Print web worker files | |
run: | | |
cd ${{ env.gui_original }} | |
ls -l ${{ env.gui_original }}/static | |
- name: check if scracth-blocks linking worked | |
run: | | |
cd ${{ env.blocks_original }} | |
npm list || true | |
- name: check if scratch-vm linking worked | |
run: | | |
cd ${{ env.vm_original }} | |
npm list || true | |
- name: check if gui linking worked | |
run: | | |
cd ${{ env.gui_original }} | |
npm list || true | |
- name: Copy replacements | |
run: | | |
cp -r ${{ env.REPLACEMENTS }}/* ${{ env.MBHome }} | |
- name: Remove unused assets | |
run: | | |
cd ${{ env.gui_original }} | |
rm -f src/lib/libraries/decks/thumbnails/* | |
rm -f src/lib/libraries/decks/steps/* | |
- name: Build Blocks | |
run: | | |
cd ${{ env.blocks_original }} | |
NODE_ENV=production npm run prepublish | |
- name: Build VM | |
run: | | |
cd ${{ env.vm_original }} | |
NODE_ENV=production npm run build | |
- name: Build Scratch | |
run: | | |
cd ${{ env.gui_original }} | |
NODE_ENV=production npm run build | |
- name: print gui components | |
run: | | |
cd ${{ env.gui_original }} | |
ls -l ${{ env.gui_original }}/src/components | |
- name: Copy dist files | |
run: | | |
mkdir -p ${{ env.MBHome }}/dist | |
cp -r ${{ env.gui_original }}/build/* ${{ env.MBHome }}/dist | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16.15.0 | |
registry-url: "https://registry.npmjs.org" | |
- run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |