Skip to content

Commit

Permalink
chore: inject build version number
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Feb 2, 2025
1 parent 9e0961a commit 1c2032c
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 58 deletions.
123 changes: 65 additions & 58 deletions .github/workflows/node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@ jobs:
with:
node-version-file: '.node-version'

- name: Run build
run: |
corepack enable
# try and avoid timeout errors
yarn config set httpTimeout 100000
yarn
yarn --cwd webui install
yarn dist
- name: Determine files to upload
id: filenames
shell: bash
Expand All @@ -80,6 +69,19 @@ jobs:
echo "targetname=companion-satellite-x64-${COUNT}-${HASH}.tar.gz" >> $GITHUB_OUTPUT
echo "longversion=${VERSION}+${COUNT}-${HASH}" >> $GITHUB_OUTPUT
- name: Run build
run: |
corepack enable
# try and avoid timeout errors
yarn config set httpTimeout 100000
yarn
yarn --cwd webui install
yarn dist
env:
BUILD_VERSION: ${{ steps.filenames.outputs.longversion }}

- name: Upload build
uses: bitfocus/actions/upload-and-notify@main
with:
Expand Down Expand Up @@ -122,17 +124,6 @@ jobs:
with:
node-version-file: '.node-version'

- name: Run build
run: |
corepack enable
# try and avoid timeout errors
yarn config set httpTimeout 100000
yarn
yarn --cwd webui install
yarn dist linux-arm64
- name: Determine files to upload
id: filenames
shell: bash
Expand All @@ -145,6 +136,19 @@ jobs:
echo "targetname=companion-satellite-arm64-${COUNT}-${HASH}.tar.gz" >> $GITHUB_OUTPUT
echo "longversion=${VERSION}+${COUNT}-${HASH}" >> $GITHUB_OUTPUT
- name: Run build
run: |
corepack enable
# try and avoid timeout errors
yarn config set httpTimeout 100000
yarn
yarn --cwd webui install
yarn dist linux-arm64
env:
BUILD_VERSION: ${{ steps.filenames.outputs.longversion }}

- name: Upload build
uses: bitfocus/actions/upload-and-notify@main
with:
Expand Down Expand Up @@ -182,6 +186,18 @@ jobs:
with:
node-version-file: '.node-version'

- name: Determine files to upload
id: filenames
shell: bash
run: |
HASH=$(git rev-parse --short HEAD)
COUNT=$(git rev-list --count HEAD)
VERSION=$(node -e "console.log(require('./package.json').version)")
echo "sourcename=electron-output/companion-satellite-x64.exe" >> $GITHUB_OUTPUT
echo "targetname=companion-satellite-x64-${COUNT}-${HASH}.exe" >> $GITHUB_OUTPUT
echo "longversion=${VERSION}+${COUNT}-${HASH}" >> $GITHUB_OUTPUT
- name: Run build
shell: bash
run: |
Expand All @@ -208,6 +224,7 @@ jobs:
yarn dist win32-x64
env:
CI: 1
BUILD_VERSION: ${{ steps.filenames.outputs.longversion }}

- name: build & package (signed)
if: ${{ runner.environment == 'self-hosted' }}
Expand All @@ -226,18 +243,6 @@ jobs:
CSC_LINK: c:\\actions-runner-bitfocusas\\codesign.cer
BF_CODECERT_KEY: ${{ secrets.BF_CODECERT_KEY }}

- name: Determine files to upload
id: filenames
shell: bash
run: |
HASH=$(git rev-parse --short HEAD)
COUNT=$(git rev-list --count HEAD)
VERSION=$(node -e "console.log(require('./package.json').version)")
echo "sourcename=electron-output/companion-satellite-x64.exe" >> $GITHUB_OUTPUT
echo "targetname=companion-satellite-x64-${COUNT}-${HASH}.exe" >> $GITHUB_OUTPUT
echo "longversion=${VERSION}+${COUNT}-${HASH}" >> $GITHUB_OUTPUT
- name: Upload build
uses: bitfocus/actions/upload-and-notify@main
with:
Expand Down Expand Up @@ -275,6 +280,18 @@ jobs:
with:
node-version-file: '.node-version'

- name: Determine files to upload
id: filenames
shell: bash
run: |
HASH=$(git rev-parse --short HEAD)
COUNT=$(git rev-list --count HEAD)
VERSION=$(node -e "console.log(require('./package.json').version)")
echo "sourcename=electron-output/companion-satellite-x64.dmg" >> $GITHUB_OUTPUT
echo "targetname=companion-satellite-x64-${COUNT}-${HASH}.dmg" >> $GITHUB_OUTPUT
echo "longversion=${VERSION}+${COUNT}-${HASH}" >> $GITHUB_OUTPUT
- name: Run build
shell: bash
run: |
Expand All @@ -300,18 +317,7 @@ jobs:
APPLE_ID: ${{ secrets.APPLEID }}
APPLE_TEAM_ID: ${{ secrets.APPLETEAMID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLEIDPASS }}

- name: Determine files to upload
id: filenames
shell: bash
run: |
HASH=$(git rev-parse --short HEAD)
COUNT=$(git rev-list --count HEAD)
VERSION=$(node -e "console.log(require('./package.json').version)")
echo "sourcename=electron-output/companion-satellite-x64.dmg" >> $GITHUB_OUTPUT
echo "targetname=companion-satellite-x64-${COUNT}-${HASH}.dmg" >> $GITHUB_OUTPUT
echo "longversion=${VERSION}+${COUNT}-${HASH}" >> $GITHUB_OUTPUT
BUILD_VERSION: ${{ steps.filenames.outputs.longversion }}

- name: Upload build
uses: bitfocus/actions/upload-and-notify@main
Expand Down Expand Up @@ -350,6 +356,18 @@ jobs:
with:
node-version-file: '.node-version'

- name: Determine files to upload
id: filenames
shell: bash
run: |
HASH=$(git rev-parse --short HEAD)
COUNT=$(git rev-list --count HEAD)
VERSION=$(node -e "console.log(require('./package.json').version)")
echo "sourcename=electron-output/companion-satellite-arm64.dmg" >> $GITHUB_OUTPUT
echo "targetname=companion-satellite-arm64-${COUNT}-${HASH}.dmg" >> $GITHUB_OUTPUT
echo "longversion=${VERSION}+${COUNT}-${HASH}" >> $GITHUB_OUTPUT
- name: Run build
shell: bash
run: |
Expand All @@ -375,18 +393,7 @@ jobs:
APPLE_ID: ${{ secrets.APPLEID }}
APPLE_TEAM_ID: ${{ secrets.APPLETEAMID }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLEIDPASS }}

- name: Determine files to upload
id: filenames
shell: bash
run: |
HASH=$(git rev-parse --short HEAD)
COUNT=$(git rev-list --count HEAD)
VERSION=$(node -e "console.log(require('./package.json').version)")
echo "sourcename=electron-output/companion-satellite-arm64.dmg" >> $GITHUB_OUTPUT
echo "targetname=companion-satellite-arm64-${COUNT}-${HASH}.dmg" >> $GITHUB_OUTPUT
echo "longversion=${VERSION}+${COUNT}-${HASH}" >> $GITHUB_OUTPUT
BUILD_VERSION: ${{ steps.filenames.outputs.longversion }}

- name: Upload build
uses: bitfocus/actions/upload-and-notify@main
Expand Down
2 changes: 2 additions & 0 deletions tools/build_electron.mts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ const satellitePkgJson = JSON.parse(satellitePkgJsonStr.toString())
satellitePkgJson.updateChannel = process.env.EB_UPDATE_CHANNEL
console.log('Injecting update channel: ' + satellitePkgJson.updateChannel)

if (process.env.BUILD_VERSION) satellitePkgJson.version = process.env.BUILD_VERSION

await fs.writeFile(satellitePkgJsonPath, JSON.stringify(satellitePkgJson))

try {
Expand Down

0 comments on commit 1c2032c

Please sign in to comment.