From 1c1d61bd6053491158265d21b74a3874f35a6780 Mon Sep 17 00:00:00 2001 From: Anton Bracke Date: Fri, 18 Feb 2022 11:49:53 +0100 Subject: [PATCH] add release and electron-builder setup --- .../workflows/build-and-release-desktop.yml | 104 ++++++++++++++++++ desktop/.gitignore | 2 +- desktop/electron-builder.yml | 33 ++++++ desktop/package.json | 41 +------ desktop/tsconfig.json | 2 +- 5 files changed, 145 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/build-and-release-desktop.yml create mode 100644 desktop/electron-builder.yml diff --git a/.github/workflows/build-and-release-desktop.yml b/.github/workflows/build-and-release-desktop.yml new file mode 100644 index 00000000..e166c47f --- /dev/null +++ b/.github/workflows/build-and-release-desktop.yml @@ -0,0 +1,104 @@ +name: Build & Release Desktop App + +on: + push: + branches: + - master + - develop + pull_request: + release: + types: [created] + +jobs: + build_on_linux: + runs-on: ubuntu-latest + steps: + - name: "Checkout" + uses: "actions/checkout@v2.0.0" + + - name: "Setup NodeJS" + uses: actions/setup-node@v1 + with: + node-version: '14.x' + + - name: "Install dependencies" + run: yarn install --froze-lockfile + working-directory: "desktop" + + - name: "Build Typescript" + run: yarn build + working-directory: "desktop" + + - name: "Build App" + run: yarn bundle + working-directory: "desktop" + if: ${{ github.event_name != 'release' }} + + - name: "Build & Publish App" + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: yarn release + working-directory: "desktop" + if: ${{ github.event_name == 'release' }} + + build_on_mac: + runs-on: macos-latest + steps: + - name: "Checkout" + uses: "actions/checkout@v2.0.0" + + - name: "Setup NodeJS" + uses: actions/setup-node@v1 + with: + node-version: '14.x' + + - name: "Install dependencies" + run: yarn install --froze-lockfile + working-directory: "desktop" + + - name: "Build Typescript" + run: yarn build + working-directory: "desktop" + + - name: "Build App" + run: yarn bundle + working-directory: "desktop" + if: ${{ github.event_name != 'release' }} + + - name: "Build & Publish App" + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: yarn release + working-directory: "desktop" + if: ${{ github.event_name == 'release' }} + + build_on_win: + runs-on: windows-latest + steps: + - name: "Checkout" + uses: "actions/checkout@v2.0.0" + + - name: "Setup NodeJS" + uses: actions/setup-node@v1 + with: + node-version: '14.x' + + - name: "Install dependencies" + run: yarn install --froze-lockfile + working-directory: "desktop" + + - name: "Build Typescript" + run: yarn build + working-directory: "desktop" + + - name: "Build App" + run: yarn bundle + working-directory: "desktop" + if: ${{ github.event_name != 'release' }} + + - name: "Build & Publish App" + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: yarn release + working-directory: "desktop" + if: ${{ github.event_name == 'release' }} diff --git a/desktop/.gitignore b/desktop/.gitignore index ca0a17d7..0cc5bd90 100644 --- a/desktop/.gitignore +++ b/desktop/.gitignore @@ -1,4 +1,4 @@ /dist/ /node_modules/ -/dist/bundle.js /yarn-error.log +/build/ \ No newline at end of file diff --git a/desktop/electron-builder.yml b/desktop/electron-builder.yml new file mode 100644 index 00000000..98c64031 --- /dev/null +++ b/desktop/electron-builder.yml @@ -0,0 +1,33 @@ +appId: re.workadventu.desktop + +files: + - "build/**/*" + - "assets/**/*" + - "sidebar/**/*" + +dmg: + icon: false + +linux: + category: "TODO;TODO" + packageCategory: "TODO;TODO" + maintainer: "TODO" + icon: "assets/icons/TODO.icns" + description: "TODO" + target: + # - deb + - zip + - AppImage + + artifactName: "${productName}-${version}-${arch}.${ext}" + +win: + icon: "assets/icons/TODO.ico" + artifactName: "${productName}-${version}-setup.${ext}" + +publish: + provider: github + owner: thecodingmachine + repo: workadventure + vPrefixedTagName: false + releaseType: draft diff --git a/desktop/package.json b/desktop/package.json index 457f59de..1351170f 100644 --- a/desktop/package.json +++ b/desktop/package.json @@ -1,13 +1,15 @@ { - "name": "@workadventure/desktop", + "name": "workadventure-desktop", "version": "1.0.0", "description": "", - "main": "index.js", + "main": "build/main.js", "license": "SEE LICENSE IN LICENSE.txt", "scripts": { - "build": "tsup-node ./src/main.ts ./src/sidebar/preload.ts ./src/app/preload.js", + "build": "tsup-node -d build ./src/main.ts ./src/sidebar/preload.ts ./src/app/preload.ts", + "dev": "yarn build --watch --onSuccess 'yarn electron build/main.js'", + "bundle": "electron-builder install-app-deps && electron-builder", + "release": "yarn bundle", "typecheck": "tsc --noEmit", - "dev": "yarn build --watch --onSuccess 'yarn electron dist/main.js'", "test": "ts-node node_modules/jasmine/bin/jasmine --config=jasmine.json", "lint": "yarn eslint src/ . --ext .ts", "fix": "yarn eslint --fix src/ . --ext .ts", @@ -35,36 +37,5 @@ "prettier": "^2.5.1", "tsup": "^5.11.13", "typescript": "^3.8.3" - }, - "build": { - "appId": "re.workadventu.desktop", - "files": [ - "src/**/*", - "assets/**/*" - ], - "dmg": { - "icon": false - }, - "linux": { - "category": "TODO;TODO", - "packageCategory": "TODO;TODO", - "maintainer": "TODO", - "icon": "assets/icons/TODO.icns", - "description": "TODO", - "target": [ - "deb", - "zip", - "AppImage" - ], - "artifactName": "${productName}-${version}-${arch}.${ext}" - }, - "win": { - "icon": "assets/icons/TODO.ico", - "artifactName": "${productName}-${version}-setup.${ext}" - }, - "publish": { - "provider": "generic", - "url": "TODO" - } } } diff --git a/desktop/tsconfig.json b/desktop/tsconfig.json index 78248218..2c73c49c 100644 --- a/desktop/tsconfig.json +++ b/desktop/tsconfig.json @@ -14,7 +14,7 @@ // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ "sourceMap": true, /* Generates corresponding '.map' file. */ // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "./dist", /* Redirect output structure to the directory. */ + "outDir": "./build", /* Redirect output structure to the directory. */ // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */