ci: use version.cljs instead

pull/3316/head
Andelf 2021-11-28 10:01:06 +08:00 committed by Tienson Qin
parent fa003e6f57
commit 935a317c6e
3 changed files with 26 additions and 10 deletions

View File

@ -24,7 +24,7 @@ on:
type: boolean
required: true
default: true
schedule: # Every weekday at the noon (UTC) we run a scheduled nightly build
schedule: # Every workday at the noon (UTC) we run a scheduled nightly build
- cron: '0 12 * * MON-FRI'
env:
@ -75,15 +75,20 @@ jobs:
with:
cli: ${{ env.CLOJURE_VERSION }}
- name: Compile CLJS
run: yarn install && gulp build && yarn cljs:release-electron
- name: Retrieve tag version
id: ref
run: |
pkgver=$(node ./scripts/get-pkg-version.js "${{ github.event.inputs.build-target }}")
echo ::set-output name=version::$pkgver
- name: Update Nightly APP Version
if: ${{ github.event.inputs.build-target == 'nightly' }}
run: |
sed -i 's/defonce version ".*"/defonce version "${{ steps.ref.outputs.version }}"/g' src/main/frontend/version.cljs
- name: Compile CLJS
run: yarn install && gulp build && yarn cljs:release-electron
- name: Update APP Version
run: |
sed -i 's/"version": "0.0.1"/"version": "${{ steps.ref.outputs.version }}"/g' ./package.json

View File

@ -1,6 +1,6 @@
{
"name": "logseq",
"version": "0.5.1",
"version": "0.0.1",
"private": true,
"main": "static/electron.js",
"devDependencies": {

View File

@ -1,11 +1,22 @@
// This script file outputs the version in the package.json of project dir,
// and optionally add nightly postfix.
//
// It is used as a helper by the continuous integration.
// This script file simply outputs the version in the package.json.
// It is used as a helper by the continuous integration
const path = require('path')
const process = require('process')
const fs = require('fs')
const ver = require(path.join(__dirname, '../package.json')).version
const content = fs.readFileSync(
path.join(__dirname, '../src/main/frontend/version.cljs')
)
const pattern = /\(defonce version "(.*?)"\)/g
const match = pattern.exec(content)
let ver = '0.0.1'
if (match) {
ver = match[1]
} else {
console.error('Could not find version in version.cljs')
process.exit(1)
}
if (process.argv[2] === 'nightly') {
const today = new Date()