|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - dev |
| 7 | + |
| 8 | +jobs: |
| 9 | + release: |
| 10 | + name: build and release electron app |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + |
| 13 | + strategy: |
| 14 | + fail-fast: false |
| 15 | + matrix: |
| 16 | + os: [windows-latest, macos-latest, macos-12, ubuntu-latest] |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Check out git repository |
| 20 | + uses: actions/checkout@v3.0.0 |
| 21 | + |
| 22 | + - name: Install Node.js |
| 23 | + uses: actions/setup-node@v3.0.0 |
| 24 | + with: |
| 25 | + node-version: '14' |
| 26 | + |
| 27 | + - name: Release for Windows |
| 28 | + if: matrix.os == 'windows-latest' |
| 29 | + run: | |
| 30 | + cd C:\Users |
| 31 | + mkdir Downloads |
| 32 | + git clone https://github.com/Seeed-Projects/seeed-codecraft D:\Users\Downloads\ws |
| 33 | + cd D: |
| 34 | + cd D:\Users\Downloads\ws\blocks && npm install -y --unsafe-perm=true |
| 35 | + cd D:\Users\Downloads\ws\blocks && npm run build |
| 36 | + cd D:\Users\Downloads\ws\l10n && npm install -y --unsafe-perm=true |
| 37 | + cd D:\Users\Downloads\ws\l10n && npm run build |
| 38 | + cd D:\Users\Downloads\ws\vm && npm install -y --unsafe-perm=true |
| 39 | + cd D:\Users\Downloads\ws\vm && npm run build |
| 40 | + cd D:\Users\Downloads\ws\gui && npm run build-win |
| 41 | + cd D:\Users\Downloads\ws\gui && Xcopy D:\Users\Downloads\ws\gui\build D:\Users\Downloads\ws\main\app\gui /E/H/C/I |
| 42 | + cd D:\Users\Downloads\ws\main\app && npm install -y --unsafe-perm=true && .\node_modules\.bin\electron-rebuild serialport |
| 43 | + cd D:\Users\Downloads\ws\main && npm install -y --unsafe-perm=true && rm -rf build && npm run publish-win64 |
| 44 | + |
| 45 | + env: |
| 46 | + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
| 47 | + |
| 48 | + - name: Release for MacOS arm |
| 49 | + if: matrix.os == 'macos-latest' |
| 50 | + run: | |
| 51 | + echo $PWD |
| 52 | + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
| 53 | + export PATH="/usr/local/bin:/usr/local/sbin:$PATH" |
| 54 | + brew install python@2 |
| 55 | + export PATH="/usr/local/opt/python@2/libexec/bin:$PATH" |
| 56 | + alias python=python2 |
| 57 | + export script_dir=$PWD |
| 58 | + brew install python2 |
| 59 | + cd ${script_dir}/gui && npm install -y --unsafe-perm=true |
| 60 | + cd ${script_dir}/blocks && npm install -y --unsafe-perm=true |
| 61 | + cd ${script_dir}/blocks && npm run build |
| 62 | + cd ${script_dir}/l10n && npm install -y --unsafe-perm=true |
| 63 | + cd ${script_dir}/l10n && npm run build |
| 64 | + cd ${script_dir}/vm && npm install -y --unsafe-perm=true |
| 65 | + cd ${script_dir}/vm && npm run build |
| 66 | + cd ${script_dir}/gui && npm run build-mac |
| 67 | + cd ${script_dir}/gui && rm -rf ../main/app/gui && cp -r ./build ../main/app/gui |
| 68 | + cd ${script_dir}/main/app && npm install -y --unsafe-perm=true && ./node_modules/.bin/electron-rebuild serialport |
| 69 | + cd ${script_dir}/main && npm install -y --unsafe-perm=true && rm -rf build && npm run publish-mac |
| 70 | + |
| 71 | +
|
| 72 | + - name: Release for MacOS x86 |
| 73 | + if: matrix.os == 'macos-12' |
| 74 | + run: | |
| 75 | + echo $PWD |
| 76 | + /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" |
| 77 | + export PATH="/usr/local/bin:/usr/local/sbin:$PATH" |
| 78 | + brew install python@2 |
| 79 | + export PATH="/usr/local/opt/python@2/libexec/bin:$PATH" |
| 80 | + alias python=python2 |
| 81 | + export script_dir=$PWD |
| 82 | + brew install python2 |
| 83 | + cd ${script_dir}/gui && npm install -y --unsafe-perm=true |
| 84 | + cd ${script_dir}/blocks && npm install -y --unsafe-perm=true |
| 85 | + cd ${script_dir}/blocks && npm run build |
| 86 | + cd ${script_dir}/l10n && npm install -y --unsafe-perm=true |
| 87 | + cd ${script_dir}/l10n && npm run build |
| 88 | + cd ${script_dir}/vm && npm install -y --unsafe-perm=true |
| 89 | + cd ${script_dir}/vm && npm run build |
| 90 | + cd ${script_dir}/gui && npm run build-mac |
| 91 | + cd ${script_dir}/gui && rm -rf ../main/app/gui && cp -r ./build ../main/app/gui |
| 92 | + cd ${script_dir}/main/app && npm install -y --unsafe-perm=true && ./node_modules/.bin/electron-rebuild serialport |
| 93 | + cd ${script_dir}/main && npm install -y --unsafe-perm=true && rm -rf build && npm run publish-mac |
| 94 | + |
| 95 | +
|
| 96 | + - name: Release for Linux |
| 97 | + if: matrix.os == 'ubuntu-latest' |
| 98 | + run: | |
| 99 | + sudo apt update && sudo apt upgrade -y |
| 100 | + sudo apt install python2.7 -y |
| 101 | + sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 2 |
| 102 | + sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10 |
| 103 | + |
| 104 | + echo $PWD |
| 105 | + export script_dir=$PWD |
| 106 | + cd ${script_dir}/gui && npm install -y --unsafe-perm=true |
| 107 | + cd ${script_dir}/blocks && npm install -y --unsafe-perm=true |
| 108 | + cd ${script_dir}/blocks && npm run build |
| 109 | + cd ${script_dir}/l10n && npm install -y --unsafe-perm=true |
| 110 | + cd ${script_dir}/l10n && npm run build |
| 111 | + cd ${script_dir}/vm && npm install -y --unsafe-perm=true |
| 112 | + cd ${script_dir}/vm && npm run build |
| 113 | + cd ${script_dir}/gui && npm run build-mac |
| 114 | + cd ${script_dir}/gui && rm -rf ../main/app/gui && cp -r ./build ../main/app/gui |
| 115 | + cd ${script_dir}/main/app && npm install -y --unsafe-perm=true && ./node_modules/.bin/electron-rebuild serialport |
| 116 | + cd ${script_dir}/main && npm install -y --unsafe-perm=true && rm -rf build && npm run publish-linux |
0 commit comments