fix desktop app releasing (#2116)

* fix app releasing

* fix sed for macos

* fix setting app version on all oses
This commit is contained in:
Anbraten 2022-04-25 10:18:13 +02:00 committed by GitHub
parent 5cc97483e0
commit 03edc197d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 32 additions and 8 deletions

View File

@ -60,6 +60,10 @@ jobs:
run: yarn build run: yarn build
working-directory: "desktop/local-app" working-directory: "desktop/local-app"
- name: "Set desktop app version"
run: node helpers/set-version.js
working-directory: "desktop/electron"
- name: "Install dependencies" - name: "Install dependencies"
run: yarn install --froze-lockfile run: yarn install --froze-lockfile
working-directory: "desktop/electron" working-directory: "desktop/electron"
@ -68,15 +72,19 @@ jobs:
run: yarn build run: yarn build
working-directory: "desktop/electron" working-directory: "desktop/electron"
- name: "Build app" - name: "Install electron tools"
run: yarn bundle --publish never run: yarn electron-builder install-app-deps
working-directory: "desktop/electron"
- name: "Build app for testing"
run: yarn electron-builder --publish never
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: "desktop/electron" working-directory: "desktop/electron"
if: ${{ github.event_name != 'release' }} if: ${{ github.event_name != 'release' }}
- name: "Build & publish App" - name: "Build & release app"
run: yarn release run: yarn electron-builder --publish always
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: "desktop/electron" working-directory: "desktop/electron"

View File

@ -28,5 +28,4 @@ publish:
provider: github provider: github
owner: thecodingmachine owner: thecodingmachine
repo: workadventure repo: workadventure
vPrefixedTagName: false releaseType: release
releaseType: draft

View File

@ -0,0 +1,18 @@
const path = require('path');
const fs = require('fs');
let version = '0.0.0';
if (process.env.GITHUB_REF.startsWith('refs/tags/v')) {
version = process.env.GITHUB_REF.replace('refs/tags/v', '');
}
console.log('Version:', version);
const packageJsonPath = path.resolve(__dirname, '..', 'package.json');
let data = fs.readFileSync(packageJsonPath, 'utf8');
data = data.replace('managedbyci', version);
fs.writeFileSync(packageJsonPath, data);

View File

@ -1,6 +1,6 @@
{ {
"name": "workadventure-desktop", "name": "workadventure-desktop",
"version": "1.0.0", "version": "managedbyci",
"description": "Desktop application for WorkAdventure", "description": "Desktop application for WorkAdventure",
"author": "thecodingmachine", "author": "thecodingmachine",
"main": "dist/main.js", "main": "dist/main.js",
@ -11,7 +11,6 @@
"dev": "yarn build --watch --onSuccess 'yarn electron dist/main.js'", "dev": "yarn build --watch --onSuccess 'yarn electron dist/main.js'",
"dev:local-app": "cd ../local-app && yarn && yarn dev", "dev:local-app": "cd ../local-app && yarn && yarn dev",
"bundle": "yarn build:local-app && yarn build && electron-builder install-app-deps && electron-builder", "bundle": "yarn build:local-app && yarn build && electron-builder install-app-deps && electron-builder",
"release": "yarn bundle",
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"test": "exit 0", "test": "exit 0",
"lint": "yarn eslint src/ . --ext .ts", "lint": "yarn eslint src/ . --ext .ts",