diff --git a/.github/workflows/build_at_home.yaml b/.github/workflows/build_at_home.yaml index 437d968..ed98384 100644 --- a/.github/workflows/build_at_home.yaml +++ b/.github/workflows/build_at_home.yaml @@ -32,7 +32,6 @@ jobs: - name: npm build run: npm run build:win:home env: - CI: true REACT_APP_AT_HOME: true # Build electron app package installers diff --git a/version.js b/version.js index 415c511..e2cc933 100644 --- a/version.js +++ b/version.js @@ -3,13 +3,23 @@ const fs = require('fs-extra') const execa = require('execa'); -const rev = execa.commandSync('git rev-parse HEAD').stdout -const branch = execa.commandSync('git branch --show-current').stdout -const git = {rev, branch} +let git; + +if (process.env.CI) { + const sha = process.env.GITHUB_SHA + const ref = process.env.GITHUB_REF + git = {sha, ref} +} +else { + const sha = execa.commandSync('git rev-parse HEAD').stdout + const ref = execa.commandSync('git branch --show-current').stdout + git = {sha, ref} +} + fs.writeFile('public/config/version.json', JSON.stringify(git)) .then(() => { - console.log(`Saved version file with rev: ${git.rev}, branch: ${git.branch}`); + console.log(`Saved version file with rev: ${git.sha}, branch: ${git.ref}`); }) .catch((err) => { console.log(err);