Skip to content

Electron Builder CI #169

Electron Builder CI

Electron Builder CI #169

name: Electron Builder CI
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
env:
CC: clang
CXX: clang++
npm_config_clang: 1
APPLEID: ${{ secrets.APPLEID }}
APPLEIDPASS: ${{ secrets.APPLEIDPASS }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
CSC_LINK: ${{ secrets.CSC_LINK }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAP_TOKEN }}
OS_NAME: ${{ matrix.os }}
GH_REF: ${{ github.ref }}
steps:
- name: Checkout reposistory
uses: actions/checkout@v4
with:
submodules: true
- name: Checkout drawio-dev
uses: actions/checkout@v4
with:
repository: jgraph/drawio-dev
token: ${{ secrets.GH_TOKEN }}
ref: release
path: drawio-dev
submodules: false
- name: Get drawio Tag & Submodules
run: |
cd drawio-dev
# Get the current build tag from draw.io
export tmp1=${GH_REF/refs\//}
export tmp2=${tmp1/\/v/\/diagramly-}
export tmp3=${tmp2//\./_}
git fetch origin refs/$tmp3:refs/$tmp3 --no-tags
git checkout $tmp3 -b tmp-deploy
cp src/main/webapp/js/*.min.js ../drawio/src/main/webapp/js/
cd ..
rm -rf drawio-dev
cd drawio
rm -rf etc src/main/java src/main/mxgraph src/main/webapp/connect src/main/webapp/shapes src/main/webapp/stencils src/main/webapp/service-worker* src/main/webapp/workbox-*
cd src/main/webapp/js
cp diagramly/DesktopLibrary.js diagramly/ElectronApp.js .
rm -rf atlas-viewer.min.js atlas.min.js cryptojs deflate diagramly dropbox embed* freehand grapheditor integrate.min.js jquery jscolor onedrive orgchart reader.min.js rough sanitizer shapes.min.js simplepeer spin viewer-static.min.js viewer.min.js
mkdir diagramly
mv DesktopLibrary.js ElectronApp.js diagramly
- name: Installing Node
uses: actions/setup-node@v3
with:
node-version: 20
- name: Build for ${{ matrix.os}}
run: |
if [ "$OS_NAME" = "ubuntu-latest" ]; then sudo apt-get update && sudo apt-get install -y icnsutils graphicsmagick xz-utils rpm; fi
curl -o- -L https://yarnpkg.com/install.sh | bash
export PATH="$HOME/.yarn/bin:$PATH"
sudo npm install -g yarn
yarn install
if [ "$OS_NAME" = "ubuntu-latest" ]; then sed -ie 's/"asar": true,/"asar": true,\n"productName": "drawio",/' electron-builder-linux-mac.json; fi
yarn run sync
yarn run release-linux
- name: Build for Snap
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
#To generate SNAP_TOKEN run `snapcraft export-login [FILE]` and login with your snapcraft credentials. It is used now without login
sudo snap install snapcraft --classic
yarn run release-snap
# Cannot configure electron-builder to publish to stable channel, so do it explicitly
snapcraft push --release edge dist/draw.io-amd64-*.snap