From f0c1f1b16babd8c13952f6c5edc2483d3b37dc35 Mon Sep 17 00:00:00 2001 From: Joseph Flinn <58369717+joseph-flinn@users.noreply.github.com> Date: Wed, 14 Jul 2021 11:41:05 -0700 Subject: [PATCH] Fix the Windows Node Exe details (#350) * fixing the resource hacker hash checking issue * updating package command * updating the release workflow to match the build workflow. Removing the unneeded env var * fixing some formatting --- .github/workflows/build.yml | 43 +++++++++++++++++++---------------- .github/workflows/release.yml | 35 +++++++++++++++------------- package.json | 4 ++-- 3 files changed, 44 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9926cc3728..35150ea118 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,6 +23,9 @@ jobs: cli: name: Build CLI runs-on: windows-latest + env: + WIN_PKG_FETCH_VERSION: 14.17.0 + WIN_PKG_VERSION: 3.1 steps: - name: Checkout repo uses: actions/checkout@v2 @@ -45,34 +48,34 @@ jobs: run: | $env:pkgVersion = (Get-Content -Raw -Path .\package.json | ConvertFrom-Json).version echo "PACKAGE_VERSION=$env:pkgVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - 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.1\fetched-v14.17.0-win-x64 - - name: get pkg-fetch + - name: Get pkg-fetch shell: pwsh run: | cd $HOME - $fetchedUrl = "https://github.com/vercel/pkg-fetch/releases/download/v3.1/node-v14.17.0-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.1 - Invoke-RestMethod -Uri $fetchedUrl -OutFile ".\.pkg-cache\v3.1\fetched-v14.17.0-win-x64" - env: - WIN_PKG: C:\Users\runneradmin\.pkg-cache\v3.1\fetched-v14.17.0-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: Setup Version Info shell: pwsh run: ./scripts/make-versioninfo.ps1 + # https://github.com/vercel/pkg-fetch/issues/188 - name: Resource Hacker shell: cmd run: | set PATH=%PATH%;C:\Program Files (x86)\Resource Hacker - ResourceHacker -open %WIN_PKG% -save %WIN_PKG% -action delete -mask ICONGROUP,1, + 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 + + copy %WIN_PKG% %WIN_PKG_BUILT% + ResourceHacker -open %WIN_PKG_BUILT% -save %WIN_PKG_BUILT% -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 + ResourceHacker -open %WIN_PKG_BUILT% -save %WIN_PKG_BUILT% -action addoverwrite -resource version-info.res - name: Setup sub-module run: npm run sub:init @@ -121,49 +124,49 @@ jobs: checksum -f="./dist/bw-linux-${env:PACKAGE_VERSION}.zip" ` -t sha256 | Out-File -Encoding ASCII ./dist/bw-linux-sha256-${env:PACKAGE_VERSION}.txt - - name: Publish windows zip to GitHub + - name: Upload windows zip asset if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@v2 with: name: bw-windows-${{ env.PACKAGE_VERSION }}.zip path: ./dist/bw-windows-${{ env.PACKAGE_VERSION }}.zip - - name: Publish windows checksum to GitHub + - name: Upload windows checksum asset if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@v2 with: name: bw-windows-sha256-${{ env.PACKAGE_VERSION }}.txt path: ./dist/bw-windows-sha256-${{ env.PACKAGE_VERSION }}.txt - - name: Publish macos zip to GitHub + - name: Upload macos zip asset if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@v2 with: name: bw-macos-${{ env.PACKAGE_VERSION }}.zip path: ./dist/bw-macos-${{ env.PACKAGE_VERSION }}.zip - - name: Publish macos checksum to GitHub + - name: Upload macos checksum asset if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@v2 with: name: bw-macos-sha256-${{ env.PACKAGE_VERSION }}.txt path: ./dist/bw-macos-sha256-${{ env.PACKAGE_VERSION }}.txt - - name: Publish linux zip to GitHub + - name: Upload linux zip asset if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@v2 with: name: bw-linux-${{ env.PACKAGE_VERSION }}.zip path: ./dist/bw-linux-${{ env.PACKAGE_VERSION }}.zip - - name: Publish linux checksum to GitHub + - name: Upload linux checksum asset if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@v2 with: name: bw-linux-sha256-${{ env.PACKAGE_VERSION }}.txt path: ./dist/bw-linux-sha256-${{ env.PACKAGE_VERSION }}.txt - - name: Publish Chocolatey CLI + - name: Upload Chocolatey asset if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/rc' uses: actions/upload-artifact@v2 with: @@ -235,13 +238,13 @@ jobs: run: | sudo snap remove bw - - name: Publish snap to GitHub + - name: Upload snap asset uses: actions/upload-artifact@v2 with: name: bw_${{ env.PACKAGE_VERSION }}_amd64.snap path: ./dist/snap/bw_${{ env.PACKAGE_VERSION }}_amd64.snap - - name: Publish snap checksum to GitHub + - name: Upload snap checksum asset uses: actions/upload-artifact@v2 with: name: bw-snap-sha256-${{ env.PACKAGE_VERSION }}.txt diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 20a6f0ec35..da834f51bb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -67,6 +67,9 @@ jobs: name: Build CLI runs-on: windows-latest needs: setup + env: + WIN_PKG_FETCH_VERSION: 14.17.0 + WIN_PKG_VERSION: 3.1 steps: - name: Checkout repo uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # 2.3.4 @@ -89,34 +92,34 @@ jobs: run: | $env:pkgVersion = (Get-Content -Raw -Path .\package.json | ConvertFrom-Json).version echo "PACKAGE_VERSION=$env:pkgVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - 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.1\fetched-v14.17.0-win-x64 - - name: get pkg-fetch + - name: Get pkg-fetch shell: pwsh run: | cd $HOME - $fetchedUrl = "https://github.com/vercel/pkg-fetch/releases/download/v3.1/node-v14.17.0-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.1 - Invoke-RestMethod -Uri $fetchedUrl -OutFile ".\.pkg-cache\v3.1\fetched-v14.17.0-win-x64" - env: - WIN_PKG: C:\Users\runneradmin\.pkg-cache\v3.1\fetched-v14.17.0-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: Setup Version Info shell: pwsh run: ./scripts/make-versioninfo.ps1 + # https://github.com/vercel/pkg-fetch/issues/188 - name: Resource Hacker shell: cmd run: | set PATH=%PATH%;C:\Program Files (x86)\Resource Hacker - ResourceHacker -open %WIN_PKG% -save %WIN_PKG% -action delete -mask ICONGROUP,1, + 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 + + copy %WIN_PKG% %WIN_PKG_BUILT% + ResourceHacker -open %WIN_PKG_BUILT% -save %WIN_PKG_BUILT% -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 + ResourceHacker -open %WIN_PKG_BUILT% -save %WIN_PKG_BUILT% -action addoverwrite -resource version-info.res - name: Setup sub-module run: npm run sub:init @@ -164,13 +167,13 @@ jobs: checksum -f="./dist/bw-linux-${env:PACKAGE_VERSION}.zip" ` -t sha256 | Out-File -Encoding ASCII ./dist/bw-linux-sha256-${env:PACKAGE_VERSION}.txt - - name: build artifact - linux zip + - name: Build artifact - linux zip uses: actions/upload-artifact@ee69f02b3dfdecd58bb31b4d133da38ba6fe3700 # 2.2.3 with: name: bw-linux-${{ env.PACKAGE_VERSION }}.zip path: ./dist/bw-linux-${{ env.PACKAGE_VERSION }}.zip - - name: upload windows zip release asset + - name: Upload windows zip release asset id: upload-windows-zip uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # 1.0.2 - Archived env: @@ -181,7 +184,7 @@ jobs: asset_path: ./dist/bw-windows-${{ env.PACKAGE_VERSION }}.zip asset_content_type: application/zip - - name: upload macos zip release asset + - name: Upload macos zip release asset id: upload-macos-zip uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # 1.0.2 - Archived env: @@ -192,7 +195,7 @@ jobs: asset_path: ./dist/bw-macos-${{ env.PACKAGE_VERSION }}.zip asset_content_type: application/zip - - name: upload linux zip release asset + - name: Upload linux zip release asset id: upload-linux-zip uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5 # 1.0.2 - Archived env: @@ -274,7 +277,7 @@ jobs: GITHUB_REF: ${{ github.ref }} GITHUB_EVENT: ${{ github.event_name }} - - name: get linux zip artifact + - name: Get linux zip artifact uses: actions/download-artifact@158ca71f7c614ae705e79f25522ef4658df18253 # 2.0.9 with: name: bw-linux-${{ env.PACKAGE_VERSION }}.zip diff --git a/package.json b/package.json index d6b6bb687d..3764c3d0f1 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,8 @@ "build:watch": "webpack --watch", "build:prod": "cross-env NODE_ENV=production webpack", "build:prod:watch": "cross-env NODE_ENV=production webpack --watch", - "package": "npm run package:win | npm run package:mac | npm run package:lin", - "package:win": "pkg . --targets win-x64 --output ./dist/windows/bw.exe", + "package": "npm run package:win && npm run package:mac && npm run package:lin", + "package:win": "pkg . --targets win-x64 --output ./dist/windows/bw.exe --build", "package:mac": "pkg . --targets macos-x64 --output ./dist/macos/bw", "package:lin": "pkg . --targets linux-x64 --output ./dist/linux/bw", "debug": "node --inspect ./build/bw.js",