diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3fddf2d..68bf1c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,9 +15,6 @@ jobs: with: node-version: 20 - - name: Get package version - run: node utils/get-version.js >> $GITHUB_ENV - - name: install dependencies electron-app run: npm install working-directory: electron-app @@ -44,6 +41,9 @@ jobs: run: npm run test working-directory: server + - name: Get package version + run: node utils/get-version.js >> $GITHUB_ENV + - name: Tag if new version uses: pkgdeps/git-tag-action@v2.0.5 with: @@ -89,13 +89,10 @@ jobs: with: node-version: 20 - - name: Get package version - run: node utils/get-version.js >> $GITHUB_ENV - - name: Set version in source run: |- - node utils/set-version.js electron-app/package.json ${{ env.PACKAGE_VERSION }} - node utils/set-version.js electron-app/src/index.ts ${{ env.PACKAGE_VERSION }} + node utils/set-version.js electron-app/package.json + node utils/set-version.js electron-app/src/index.ts - name: install dependencies electron-app run: npm install @@ -160,8 +157,10 @@ jobs: with: node-version: 20 - - name: Get package version - run: node utils/get-version.js >> $GITHUB_ENV + - name: Set version in source + run: |- + node utils/set-version.js electron-app/package.json + node utils/set-version.js electron-app/src/index.ts - name: install dependencies electron-app run: npm install @@ -171,11 +170,6 @@ jobs: run: npm install working-directory: server - - name: Set version in source - run: |- - node utils/set-version.js electron-app/package.json ${{ env.PACKAGE_VERSION }} - node utils/set-version.js electron-app/src/index.ts ${{ env.PACKAGE_VERSION }} - - name: compile server env: CI: false diff --git a/package.json b/package.json index 6cce69e..2110aa6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nuclia-sync-agent-app", - "version": "1.2.13", + "version": "1.2.14", "description": "This is a Nuclia Sync Agent App", "main": "build/index.js", "scripts": { diff --git a/utils/set-version.js b/utils/set-version.js index f690bbb..dcbd98b 100644 --- a/utils/set-version.js +++ b/utils/set-version.js @@ -1,5 +1,7 @@ const fs = require('fs'); -function replaceStringInFile(filePath, version) { +const { version } = require('../package.json'); + +function replaceStringInFile(filePath) { const content = fs.readFileSync(filePath, 'utf8'); const version0 = /"version": "0\.0\.0"/; const firstPass = content.replace(version0, `"version": "${version}"`); @@ -9,5 +11,4 @@ function replaceStringInFile(filePath, version) { } const filePath = process.argv[2]; -const version = process.argv[3]; -replaceStringInFile(filePath, version); +replaceStringInFile(filePath);