From 4e941461a406fc918f3b499513bc848fba8ef5a2 Mon Sep 17 00:00:00 2001 From: Joseph Flinn <58369717+joseph-flinn@users.noreply.github.com> Date: Wed, 25 Aug 2021 11:22:30 -0700 Subject: [PATCH] Fixes the cli workflow (#147) * updating build workflow * fixing the WIN_PKG var * updating the env var in the makversion script * fixing spelling error * fixing the Resource Hacker env vars * adding in the branch check for macos runner assets --- .github/workflows/build.yml | 107 +++++++++++++++-------------------- scripts/make-versioninfo.ps1 | 2 +- 2 files changed, 48 insertions(+), 61 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9d7e176d..00481db9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,14 +36,16 @@ jobs: shell: pwsh run: | $env:pkgVersion = (Get-Content -Raw -Path ./src/package.json | ConvertFrom-Json).version - echo "::set-output name=PACKAGE_VERSION::$env:pkgVersion" + echo "::set-output name=package_version::$env:pkgVersion" cli: runs-on: windows-latest needs: setup env: - PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} + _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} + _WIN_PKG_FETCH_VERSION: 14.17.0 + _WIN_PKG_VERSION: 3.1 steps: - name: Checkout repo uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f @@ -64,24 +66,15 @@ jobs: npm install -g node-gyp node-gyp install $(node -v) - - name: Setting WIN_PKG - run: | - echo "WIN_PKG=$env:WIN_PKG" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - echo "version: $env:pkgVersion" - env: - WIN_PKG: C:\Users\runneradmin\.pkg-cache\v3.0\fetched-v14.16.1-win-x64 - - name: get pkg-fetch shell: pwsh run: | cd $HOME - $fetchedUrl = "https://github.com/vercel/pkg-fetch/releases/download/v3.0/node-v14.16.1-win-x64" + $fetchedUrl = "https://github.com/vercel/pkg-fetch/releases/download/v$env:_WIN_PKG_VERSION/node-v$env:_WIN_PKG_FETCH_VERSION-win-x64" New-Item -ItemType directory -Path ./.pkg-cache - New-Item -ItemType directory -Path ./.pkg-cache/v3.0 - Invoke-RestMethod -Uri $fetchedUrl -OutFile "./.pkg-cache/v3.0/fetched-v14.16.1-win-x64" - env: - WIN_PKG: C:\Users\runneradmin\.pkg-cache\v3.0\fetched-v14.16.1-win-x64 + New-Item -ItemType directory -Path ./.pkg-cache/v$env:_WIN_PKG_VERSION + Invoke-RestMethod -Uri $fetchedUrl -OutFile "./.pkg-cache/v$env:_WIN_PKG_VERSION/fetched-v$env:_WIN_PKG_FETCH_VERSION-win-x64" - name: Keytar shell: pwsh @@ -116,6 +109,9 @@ jobs: shell: cmd run: | set PATH=%PATH%;C:\Program Files (x86)\Resource Hacker + set WIN_PKG=C:\Users\runneradmin\.pkg-cache\v%_WIN_PKG_VERSION%\fetched-v%_WIN_PKG_FETCH_VERSION%-win-x64 + set WIN_PKG_BUILT=C:\Users\runneradmin\.pkg-cache\v%_WIN_PKG_VERSION%\built-v%_WIN_PKG_FETCH_VERSION%-win-x64 + ResourceHacker -open %WIN_PKG% -save %WIN_PKG% -action delete -mask ICONGROUP,1, ResourceHacker -open version-info.rc -save version-info.res -action compile ResourceHacker -open %WIN_PKG% -save %WIN_PKG% -action addoverwrite -resource version-info.res @@ -129,77 +125,71 @@ jobs: - name: Zip shell: cmd run: | - 7z a ./dist-cli/bwdc-windows-%PACKAGE_VERSION%.zip ./dist-cli/windows/bwdc.exe ./keytar/windows/keytar.node - 7z a ./dist-cli/bwdc-macos-%PACKAGE_VERSION%.zip ./dist-cli/macos/bwdc ./keytar/macos/keytar.node - 7z a ./dist-cli/bwdc-linux-%PACKAGE_VERSION%.zip ./dist-cli/linux/bwdc ./keytar/linux/keytar.node + 7z a ./dist-cli/bwdc-windows-%_PACKAGE_VERSION%.zip ./dist-cli/windows/bwdc.exe ./keytar/windows/keytar.node + 7z a ./dist-cli/bwdc-macos-%_PACKAGE_VERSION%.zip ./dist-cli/macos/bwdc ./keytar/macos/keytar.node + 7z a ./dist-cli/bwdc-linux-%_PACKAGE_VERSION%.zip ./dist-cli/linux/bwdc ./keytar/linux/keytar.node - name: Version Test run: | - Expand-Archive -Path "./dist-cli/bwdc-windows-${env:PACKAGE_VERSION}.zip" -DestinationPath "./test/windows" + Expand-Archive -Path "./dist-cli/bwdc-windows-${env:_PACKAGE_VERSION}.zip" -DestinationPath "./test/windows" $testVersion = Invoke-Expression '& ./test/windows/bwdc.exe -v' - echo "version: $env:PACKAGE_VERSION" + echo "version: $env:_PACKAGE_VERSION" echo "testVersion: $testVersion" - if($testVersion -ne $env:PACKAGE_VERSION) { + if($testVersion -ne $env:_PACKAGE_VERSION) { Throw "Version test failed." } - name: Create checksums run: | - checksum -f="./dist-cli/bwdc-windows-${env:PACKAGE_VERSION}.zip" ` - -t sha256 | Out-File ./dist-cli/bwdc-windows-sha256-${env:PACKAGE_VERSION}.txt - checksum -f="./dist-cli/bwdc-macos-${env:PACKAGE_VERSION}.zip" ` - -t sha256 | Out-File ./dist-cli/bwdc-macos-sha256-${env:PACKAGE_VERSION}.txt - checksum -f="./dist-cli/bwdc-linux-${env:PACKAGE_VERSION}.zip" ` - -t sha256 | Out-File ./dist-cli/bwdc-linux-sha256-${env:PACKAGE_VERSION}.txt + checksum -f="./dist-cli/bwdc-windows-${env:_PACKAGE_VERSION}.zip" ` + -t sha256 | Out-File ./dist-cli/bwdc-windows-sha256-${env:_PACKAGE_VERSION}.txt + checksum -f="./dist-cli/bwdc-macos-${env:_PACKAGE_VERSION}.zip" ` + -t sha256 | Out-File ./dist-cli/bwdc-macos-sha256-${env:_PACKAGE_VERSION}.txt + checksum -f="./dist-cli/bwdc-linux-${env:_PACKAGE_VERSION}.zip" ` + -t sha256 | Out-File ./dist-cli/bwdc-linux-sha256-${env:_PACKAGE_VERSION}.txt - name: Upload windows zip to GitHub - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 with: - name: bwdc-windows-${{ env.PACKAGE_VERSION }}.zip - path: ./dist-cli/bwdc-windows-${{ env.PACKAGE_VERSION }}.zip + name: bwdc-windows-${{ env._PACKAGE_VERSION }}.zip + path: ./dist-cli/bwdc-windows-${{ env._PACKAGE_VERSION }}.zip - name: Upload mac zip to GitHub - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 with: - name: bwdc-macos-${{ env.PACKAGE_VERSION }}.zip - path: ./dist-cli/bwdc-macos-${{ env.PACKAGE_VERSION }}.zip + name: bwdc-macos-${{ env._PACKAGE_VERSION }}.zip + path: ./dist-cli/bwdc-macos-${{ env._PACKAGE_VERSION }}.zip - name: Upload linux zip to GitHub - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 with: - name: bwdc-linux-${{ env.PACKAGE_VERSION }}.zip - path: ./dist-cli/bwdc-linux-${{ env.PACKAGE_VERSION }}.zip + name: bwdc-linux-${{ env._PACKAGE_VERSION }}.zip + path: ./dist-cli/bwdc-linux-${{ env._PACKAGE_VERSION }}.zip - name: Upload windows checksum to GitHub - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 with: - name: bwdc-windows-sha256-${{ env.PACKAGE_VERSION }}.txt - path: ./dist-cli/bwdc-windows-sha256-${{ env.PACKAGE_VERSION }}.txt + name: bwdc-windows-sha256-${{ env._PACKAGE_VERSION }}.txt + path: ./dist-cli/bwdc-windows-sha256-${{ env._PACKAGE_VERSION }}.txt - name: Upload mac checksum to GitHub - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 with: - name: bwdc-macos-sha256-${{ env.PACKAGE_VERSION }}.txt - path: ./dist-cli/bwdc-macos-sha256-${{ env.PACKAGE_VERSION }}.txt + name: bwdc-macos-sha256-${{ env._PACKAGE_VERSION }}.txt + path: ./dist-cli/bwdc-macos-sha256-${{ env._PACKAGE_VERSION }}.txt - name: Upload linux checksum to GitHub - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 with: - name: bwdc-linux-sha256-${{ env.PACKAGE_VERSION }}.txt - path: ./dist-cli/bwdc-linux-sha256-${{ env.PACKAGE_VERSION }}.txt + name: bwdc-linux-sha256-${{ env._PACKAGE_VERSION }}.txt + path: ./dist-cli/bwdc-linux-sha256-${{ env._PACKAGE_VERSION }}.txt windows_gui: runs-on: windows-latest needs: setup env: - PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} + _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} steps: - name: Set up dotnet uses: actions/setup-dotnet@a71d1eb2c86af85faa8c772c03fb365e377e45ea @@ -270,25 +260,23 @@ jobs: run: dir ./dist - name: Publish Portable Exe to GitHub - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 with: - name: Bitwarden-Connector-Portable-${{ env.PACKAGE_VERSION }}.exe - path: ./dist/Bitwarden-Connector-Portable-${{ env.PACKAGE_VERSION }}.exe + name: Bitwarden-Connector-Portable-${{ env._PACKAGE_VERSION }}.exe + path: ./dist/Bitwarden-Connector-Portable-${{ env._PACKAGE_VERSION }}.exe - name: Publish Installer Exe to GitHub - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 with: - name: Bitwarden-Connector-Installer-${{ env.PACKAGE_VERSION }}.exe - path: ./dist/Bitwarden-Connector-Installer-${{ env.PACKAGE_VERSION }}.exe + name: Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe + path: ./dist/Bitwarden-Connector-Installer-${{ env._PACKAGE_VERSION }}.exe linux: runs-on: ubuntu-latest needs: setup env: - PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} + _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} steps: - name: Set up Node uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea @@ -323,18 +311,17 @@ jobs: run: npm run dist:lin - name: Publish AppImage - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 with: - name: Bitwarden-Connector-${{ env.PACKAGE_VERSION }}-x86_64.AppImage - path: ./dist/Bitwarden-Connector-${{ env.PACKAGE_VERSION }}-x86_64.AppImage + name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-x86_64.AppImage + path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-x86_64.AppImage macos: runs-on: macos-latest needs: setup env: - PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} + _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} steps: - name: Set up Node uses: actions/setup-node@46071b5c7a2e0c34e49c3cb8a0e792e86e18d5ea @@ -403,12 +390,12 @@ jobs: if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 with: - name: Bitwarden-Connector-${{ env.PACKAGE_VERSION }}-mac.zip - path: ./dist/Bitwarden-Connector-${{ env.PACKAGE_VERSION }}-mac.zip + name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-mac.zip + path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}-mac.zip - name: Upload .dmg artifact if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 with: - name: Bitwarden-Connector-${{ env.PACKAGE_VERSION }}.dmg - path: ./dist/Bitwarden-Connector-${{ env.PACKAGE_VERSION }}.dmg + name: Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg + path: ./dist/Bitwarden-Connector-${{ env._PACKAGE_VERSION }}.dmg diff --git a/scripts/make-versioninfo.ps1 b/scripts/make-versioninfo.ps1 index 757b8d93..f2a97620 100644 --- a/scripts/make-versioninfo.ps1 +++ b/scripts/make-versioninfo.ps1 @@ -1,4 +1,4 @@ -$major,$minor,$patch = $env:PACKAGE_VERSION.split('.') +$major,$minor,$patch = $env:_PACKAGE_VERSION.split('.') $versionInfo = @"