From 336c41c054f64dba73588c39dccbaaa242cbb954 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Mon, 21 Dec 2020 23:44:29 +0000 Subject: [PATCH 01/22] initial commit of the new GH Actions workflow --- .github/workflows/build.yml | 168 ++++++++++++++++++++++++++++++++++++ 1 file changed, 168 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000000..4e4028a3b0 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,168 @@ +name: build & publish + +on: + # push: + # branches-ignore: + # - 'l10n_master' + # release: + # types: + # - published + workflow_dispatch: + + +jobs: + cloc: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Set up cloc + run: | + apt update + apt -y install cloc + + - name: Print lines of code + run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git + + + build: + name: Build CLI + runs-on: windows-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Set up Node + uses: actions/setup-node@v1 + with: + node-version: '10.x' + + - name: Setup & Build + run: | + npm install + npm sub:init + npm dist + + - name: Zip + shell: cmd + run: | + 7z a ./dist/bw-windows-%PACKAGE_VERSION%.zip ./dist/windows/bw.exe + 7z a ./dist/bw-macos-%PACKAGE_VERSION%.zip ./dist/macos/bw + 7z a ./dist/bw-linux-%PACKAGE_VERSION%.zip ./dist/linux/bw + + - name: Version Test + run: | + Expand-Archive -Path "./dist/bw-windows-${env:PACKAGE_VERSION}.zip" -DestinationPath "./test/windows" + $testVersion = Invoke-Expression '& ./test/windows/bw.exe -v' + if($testVersion -ne $env:PACKAGE_VERSION) { + Throw "Version test failed." + } + + - name: Package & Create checksums + run: | + .\scripts\choco-pack.ps1 + + checksum -f="./dist/bw-windows-${env:PACKAGE_VERSION}.zip" ` + -t sha256 | Out-File -Encoding ASCII ./dist/bw-windows-sha256-${env:PACKAGE_VERSION}.txt + checksum -f="./dist/bw-macos-${env:PACKAGE_VERSION}.zip" ` + -t sha256 | Out-File -Encoding ASCII ./dist/bw-macos-sha256-${env:PACKAGE_VERSION}.txt + 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 to GitHub + run: | + Write-Host "" + Write-Host .\dist\bw-windows-${env:PACKAGE_VERSION}.zip + Write-Host .\dist\bw-macos-${env:PACKAGE_VERSION}.zip + Write-Host .\dist\bw-linux-${env:PACKAGE_VERSION}.zip + Write-Host .\dist\bw-windows-sha256-${env:PACKAGE_VERSION}.txt + Write-Host .\dist\bw-macos-sha256-${env:PACKAGE_VERSION}.txt + Write-Host .\dist\bw-linux-sha256-${env:PACKAGE_VERSION}.txt + Write-Host .\dist\chocolatey\bitwarden-cli.${env:PACKAGE_VERSION}.nupkg + + + publish_windows: + name: Publish Windows + runs-on: windows-latest + needs: build + if: github.event_name == 'release' + steps: + - name: Setup Chocolatey + run: choco apikey --key $env:CHOCO_API_KEY --source https://push.chocolatey.org/ + env: + CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }} + + - name: Publish + run: | + .\scripts\choco-update.ps1 -version $env:PACKAGE_VERSION + + + publish_snap: + name: Publish Snap + runs-on: ubuntu-latest + needs: build + if: github.event_name == 'release' + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Install Snapcraft + uses: samuelmeuli/action-snapcraft@v1 + with: + snapcraft_token: ${{ secrets.SNAP_TOKEN }} + + - name: Print environment + run: | + whoami + snapcraft --version + echo "GitHub ref: $GITHUB_REF" + echo "GitHub event: $GITHUB_EVENT" + env: + GITHUB_REF: ${{ github.ref }} + GITHUB_EVENT: ${{ github.event_name }} + + - name: Install Snap + shell: pwsh + run: | + ./scripts/snap-build.ps1 -version $env:PACKAGE_VERSION + snap install ./dist/snap/bw*.snap --dangerous + + - name: Test Snap + shell: pwsh + run: | + $testVersion = Invoke-Expression '& bw -v' + if($testVersion -ne $env:PACKAGE_VERSION) { + Throw "Version test failed." + } + + - name: Cleanup Test & Update Snap for Publish + shell: pwsh + run: | + snap remove bw + ./scripts/snap-update.ps1 + + - name: Publish + shell: pwsh + run: | + echo "" + echo "./dist/snap/bw_${PACKAGE_VERSION}_amd64.snap" + + - name: Snap Logout + run: snapcraft logout + + + publish_npm: + name: Publish NPM + runs-on: ubuntu-latest + needs: build + if: github.event_name == 'release' + steps: + - name: Setup NPM + shell: pwsh + run: "//registry.npmjs.org/:_authToken=${env:NPM_TOKEN}" | Out-File ".npmrc" -Encoding UTF8 + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish NPM + run: npm run publish:npm From 38d27feefa28539f91fc40ac66b9b50a545d0df9 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Mon, 21 Dec 2020 23:46:44 +0000 Subject: [PATCH 02/22] trying a fix for the yaml syntax error --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4e4028a3b0..a212351b16 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -160,7 +160,8 @@ jobs: steps: - name: Setup NPM shell: pwsh - run: "//registry.npmjs.org/:_authToken=${env:NPM_TOKEN}" | Out-File ".npmrc" -Encoding UTF8 + run: | + "//registry.npmjs.org/:_authToken=${env:NPM_TOKEN}" | Out-File ".npmrc" -Encoding UTF8 env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} From 7f2fab46b198da835b3e0715bcaabd8d04749344 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Mon, 21 Dec 2020 23:49:13 +0000 Subject: [PATCH 03/22] removing the manual trigger thing --- .github/workflows/build.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a212351b16..045c4dc54c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,13 +1,12 @@ name: build & publish on: - # push: - # branches-ignore: - # - 'l10n_master' - # release: - # types: - # - published - workflow_dispatch: + push: + branches-ignore: + - 'l10n_master' + release: + types: + - published jobs: From 17d33ba28878ead46c61cb1a4588b8bfc65f3b37 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Mon, 21 Dec 2020 23:53:41 +0000 Subject: [PATCH 04/22] fixing sudo issue. Splitting out the npm install => npm dist --- .github/workflows/build.yml | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 045c4dc54c..29e72bddad 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,8 +18,8 @@ jobs: - name: Set up cloc run: | - apt update - apt -y install cloc + sudo apt update + sudo apt -y install cloc - name: Print lines of code run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git @@ -37,11 +37,14 @@ jobs: with: node-version: '10.x' - - name: Setup & Build - run: | - npm install - npm sub:init - npm dist + - name: Install + run: npm install + + - name: Setup sub-module + run: npm sub:init + + - name: Build + run: npm dist - name: Zip shell: cmd From a6b2112e226551c76f23f06066e250587f15f0f7 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Tue, 22 Dec 2020 17:44:53 +0000 Subject: [PATCH 05/22] fixing the npm scripts --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 29e72bddad..419b7bf236 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,10 +41,10 @@ jobs: run: npm install - name: Setup sub-module - run: npm sub:init + run: npm run sub:init - name: Build - run: npm dist + run: npm run dist - name: Zip shell: cmd From e1aaca8a178333ae0b86197cfda7f887e58cd06d Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Tue, 22 Dec 2020 21:23:15 +0000 Subject: [PATCH 06/22] adding PACKAGE_VERSION via an env file --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 419b7bf236..c19ed490f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,6 +37,11 @@ jobs: with: node-version: '10.x' + - name: Set PACKAGE_VERSION + 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 + - name: Install run: npm install From ae8a1968372317312edb7fa58e8d1425b94a95c8 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Tue, 22 Dec 2020 21:45:05 +0000 Subject: [PATCH 07/22] debugging envs --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c19ed490f6..4461575fd9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,8 +60,12 @@ jobs: - name: Version Test run: | + dir ./dist/ Expand-Archive -Path "./dist/bw-windows-${env:PACKAGE_VERSION}.zip" -DestinationPath "./test/windows" $testVersion = Invoke-Expression '& ./test/windows/bw.exe -v' + + echo "version: $env:PACKAGE_VERSION" + echo "testVersion: $env:testVersion" if($testVersion -ne $env:PACKAGE_VERSION) { Throw "Version test failed." } From f574253aa604ad930b9ac2a1c1ba095045629148 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Tue, 22 Dec 2020 22:12:55 +0000 Subject: [PATCH 08/22] testing env --- .github/workflows/build.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4461575fd9..4f7c8768f8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,6 +41,15 @@ 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 "version: $pkgVersion" + + - name: test setting env var + run: | + echo "version: $PACKAGE_VERSION" + + if($PACKAGE_VERSION -eq "") { + Throw "test env failed." + } - name: Install run: npm install From 9d965171becd1cba9c91b50a70d4c48108894c09 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Tue, 22 Dec 2020 22:16:35 +0000 Subject: [PATCH 09/22] trying pwsh env syntax...'cause you know....it is a pwsh shell --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4f7c8768f8..b99a7a7548 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,11 +41,11 @@ 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 "version: $pkgVersion" + echo "version: $env:pkgVersion" - name: test setting env var run: | - echo "version: $PACKAGE_VERSION" + echo "version: $env:PACKAGE_VERSION" if($PACKAGE_VERSION -eq "") { Throw "test env failed." From 93d43c75bb8d3739c6b68a5aadf707db64e4edf8 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Tue, 22 Dec 2020 22:22:51 +0000 Subject: [PATCH 10/22] removing env brackets.... --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b99a7a7548..76cfd68705 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,14 +40,14 @@ jobs: - name: Set PACKAGE_VERSION 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 "PACKAGE_VERSION=$env:pkgVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append echo "version: $env:pkgVersion" - name: test setting env var run: | echo "version: $env:PACKAGE_VERSION" - if($PACKAGE_VERSION -eq "") { + if($env:PACKAGE_VERSION -eq "") { Throw "test env failed." } @@ -74,7 +74,7 @@ jobs: $testVersion = Invoke-Expression '& ./test/windows/bw.exe -v' echo "version: $env:PACKAGE_VERSION" - echo "testVersion: $env:testVersion" + echo "testVersion: $testVersion" if($testVersion -ne $env:PACKAGE_VERSION) { Throw "Version test failed." } From 69be353ef8dca328b69864d497fc9c5d4206432d Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Tue, 22 Dec 2020 22:36:37 +0000 Subject: [PATCH 11/22] installing checksum in windows builder --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 76cfd68705..b870160d65 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,6 +32,9 @@ jobs: - name: Checkout repo uses: actions/checkout@v2 + - name: Setup Windows builder + run: choco install checksum --no-progress + - name: Set up Node uses: actions/setup-node@v1 with: From 7ca96ffa2929c93a4027e5023fab2ce98e9f64b1 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Tue, 22 Dec 2020 23:21:15 +0000 Subject: [PATCH 12/22] adding github publishing --- .github/workflows/build.yml | 53 +++++++++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b870160d65..d9204a23ea 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -93,18 +93,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 to GitHub - run: | - Write-Host "" - Write-Host .\dist\bw-windows-${env:PACKAGE_VERSION}.zip - Write-Host .\dist\bw-macos-${env:PACKAGE_VERSION}.zip - Write-Host .\dist\bw-linux-${env:PACKAGE_VERSION}.zip - Write-Host .\dist\bw-windows-sha256-${env:PACKAGE_VERSION}.txt - Write-Host .\dist\bw-macos-sha256-${env:PACKAGE_VERSION}.txt - Write-Host .\dist\bw-linux-sha256-${env:PACKAGE_VERSION}.txt - Write-Host .\dist\chocolatey\bitwarden-cli.${env:PACKAGE_VERSION}.nupkg + - name: Publish windows zip to GitHub + 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 + 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 + 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 + 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 + 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 + 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 + uses: actions/upload-artifact@v2 + with: + name: bitwarden-cli.${env:PACKAGE_VERSION}.nupkg + path: ./dist/chocolatey/bitwarden-cli.${env:PACKAGE_VERSION}.nupkg + - publish_windows: name: Publish Windows runs-on: windows-latest From 757c3f6208dbdccb422ed680948a4a245505ffb9 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Wed, 23 Dec 2020 15:46:00 +0000 Subject: [PATCH 13/22] splitting out the packages --- .github/workflows/build.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d9204a23ea..70517e4435 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,7 +61,19 @@ jobs: run: npm run sub:init - name: Build - run: npm run dist + run: npm run build:prod + + - name: Clean Build + run: npm run clean + + - name: Package Windows + run: pkg . --targets win-x64 --output ./dist/windows/bw.exe + + - name: Package Mac + run: pkg . --targets macos-x64 --output ./dist/macos/bw + + - name: Package Linux + run: pkg . --targets linux-x64 --output ./dist/linux/bw - name: Zip shell: cmd From 079fd7dc82fa2d2d1d50de1549bf3810367e1fa4 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Wed, 23 Dec 2020 15:52:24 +0000 Subject: [PATCH 14/22] changing package command --- .github/workflows/build.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 70517e4435..ada723f84a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,13 +67,13 @@ jobs: run: npm run clean - name: Package Windows - run: pkg . --targets win-x64 --output ./dist/windows/bw.exe + run: npm run package:win #pkg . --targets win-x64 --output ./dist/windows/bw.exe - name: Package Mac - run: pkg . --targets macos-x64 --output ./dist/macos/bw + run: npm run package:mac #pkg . --targets macos-x64 --output ./dist/macos/bw - name: Package Linux - run: pkg . --targets linux-x64 --output ./dist/linux/bw + run: npm run package:lin #pkg . --targets linux-x64 --output ./dist/linux/bw - name: Zip shell: cmd @@ -164,6 +164,7 @@ jobs: .\scripts\choco-update.ps1 -version $env:PACKAGE_VERSION + # This process seems independent from the others publish_snap: name: Publish Snap runs-on: ubuntu-latest @@ -218,6 +219,7 @@ jobs: run: snapcraft logout + # This job is independent: it reruns 'npm run build:prod' publish_npm: name: Publish NPM runs-on: ubuntu-latest From c13e50db89de402bb651d6e4d8dae312e35ed90c Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Wed, 23 Dec 2020 18:48:51 +0000 Subject: [PATCH 15/22] debugging files --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ada723f84a..0c7fae1c51 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -105,6 +105,9 @@ 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: Debug Files + run: dir ./dist + - name: Publish windows zip to GitHub uses: actions/upload-artifact@v2 with: From 43ddc6f5fe4abd90b05d083a83424975924e2802 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Wed, 23 Dec 2020 18:59:21 +0000 Subject: [PATCH 16/22] trying different env retrieval --- .github/workflows/build.yml | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0c7fae1c51..2033cbf3b3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -67,13 +67,13 @@ jobs: run: npm run clean - name: Package Windows - run: npm run package:win #pkg . --targets win-x64 --output ./dist/windows/bw.exe + run: npm run package:win - name: Package Mac - run: npm run package:mac #pkg . --targets macos-x64 --output ./dist/macos/bw + run: npm run package:mac - name: Package Linux - run: npm run package:lin #pkg . --targets linux-x64 --output ./dist/linux/bw + run: npm run package:lin - name: Zip shell: cmd @@ -111,44 +111,44 @@ jobs: - name: Publish windows zip to GitHub uses: actions/upload-artifact@v2 with: - name: bw-windows-${env:PACKAGE_VERSION}.zip - path: ./dist/bw-windows-${env:PACKAGE_VERSION}.zip + name: bw-windows-${PACKAGE_VERSION}.zip + path: ./dist/bw-windows-${PACKAGE_VERSION}.zip - name: Publish windows checksum to GitHub uses: actions/upload-artifact@v2 with: - name: bw-windows-sha256-${env:PACKAGE_VERSION}.txt - path: ./dist/bw-windows-sha256-${env:PACKAGE_VERSION}.txt + name: bw-windows-sha256-${PACKAGE_VERSION}.txt + path: ./dist/bw-windows-sha256-${PACKAGE_VERSION}.txt - name: Publish macos zip to GitHub uses: actions/upload-artifact@v2 with: - name: bw-macos-${env:PACKAGE_VERSION}.zip - path: ./dist/bw-macos-${env:PACKAGE_VERSION}.zip + name: bw-macos-${PACKAGE_VERSION}.zip + path: ./dist/bw-macos-${PACKAGE_VERSION}.zip - name: Publish macos checksum to GitHub uses: actions/upload-artifact@v2 with: - name: bw-macos-sha256-${env:PACKAGE_VERSION}.txt - path: ./dist/bw-macos-sha256-${env:PACKAGE_VERSION}.txt + name: bw-macos-sha256-${PACKAGE_VERSION}.txt + path: ./dist/bw-macos-sha256-${PACKAGE_VERSION}.txt - name: Publish linux zip to GitHub uses: actions/upload-artifact@v2 with: - name: bw-linux-${env:PACKAGE_VERSION}.zip - path: ./dist/bw-linux-${env:PACKAGE_VERSION}.zip + name: bw-linux-${PACKAGE_VERSION}.zip + path: ./dist/bw-linux-${PACKAGE_VERSION}.zip - name: Publish linux checksum to GitHub uses: actions/upload-artifact@v2 with: - name: bw-linux-sha256-${env:PACKAGE_VERSION}.txt - path: ./dist/bw-linux-sha256-${env:PACKAGE_VERSION}.txt + name: bw-linux-sha256-${PACKAGE_VERSION}.txt + path: ./dist/bw-linux-sha256-${PACKAGE_VERSION}.txt - name: Publish Chocolatey CLI uses: actions/upload-artifact@v2 with: - name: bitwarden-cli.${env:PACKAGE_VERSION}.nupkg - path: ./dist/chocolatey/bitwarden-cli.${env:PACKAGE_VERSION}.nupkg + name: bitwarden-cli.${PACKAGE_VERSION}.nupkg + path: ./dist/chocolatey/bitwarden-cli.${PACKAGE_VERSION}.nupkg publish_windows: From 7a9899548289798f651028cbe7bda2417c2baeb5 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Wed, 23 Dec 2020 19:16:39 +0000 Subject: [PATCH 17/22] trying different env retrieval again --- .github/workflows/build.yml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2033cbf3b3..927b8fc17d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -111,44 +111,44 @@ jobs: - name: Publish windows zip to GitHub uses: actions/upload-artifact@v2 with: - name: bw-windows-${PACKAGE_VERSION}.zip - path: ./dist/bw-windows-${PACKAGE_VERSION}.zip + name: bw-windows-${{ PACKAGE_VERSION }}.zip + path: ./dist/bw-windows-${{ PACKAGE_VERSION }}.zip - name: Publish windows checksum to GitHub uses: actions/upload-artifact@v2 with: - name: bw-windows-sha256-${PACKAGE_VERSION}.txt - path: ./dist/bw-windows-sha256-${PACKAGE_VERSION}.txt + name: bw-windows-sha256-${{ PACKAGE_VERSION }}.txt + path: ./dist/bw-windows-sha256-${{ PACKAGE_VERSION }}.txt - name: Publish macos zip to GitHub uses: actions/upload-artifact@v2 with: - name: bw-macos-${PACKAGE_VERSION}.zip - path: ./dist/bw-macos-${PACKAGE_VERSION}.zip + name: bw-macos-${{ PACKAGE_VERSION }}.zip + path: ./dist/bw-macos-${{ PACKAGE_VERSION }}.zip - name: Publish macos checksum to GitHub uses: actions/upload-artifact@v2 with: - name: bw-macos-sha256-${PACKAGE_VERSION}.txt - path: ./dist/bw-macos-sha256-${PACKAGE_VERSION}.txt + name: bw-macos-sha256-${{ PACKAGE_VERSION }}.txt + path: ./dist/bw-macos-sha256-${{ PACKAGE_VERSION }}.txt - name: Publish linux zip to GitHub uses: actions/upload-artifact@v2 with: - name: bw-linux-${PACKAGE_VERSION}.zip - path: ./dist/bw-linux-${PACKAGE_VERSION}.zip + name: bw-linux-${{ PACKAGE_VERSION }}.zip + path: ./dist/bw-linux-${{ PACKAGE_VERSION }}.zip - name: Publish linux checksum to GitHub uses: actions/upload-artifact@v2 with: - name: bw-linux-sha256-${PACKAGE_VERSION}.txt - path: ./dist/bw-linux-sha256-${PACKAGE_VERSION}.txt + name: bw-linux-sha256-${{ PACKAGE_VERSION }}.txt + path: ./dist/bw-linux-sha256-${{ PACKAGE_VERSION }}.txt - name: Publish Chocolatey CLI uses: actions/upload-artifact@v2 with: - name: bitwarden-cli.${PACKAGE_VERSION}.nupkg - path: ./dist/chocolatey/bitwarden-cli.${PACKAGE_VERSION}.nupkg + name: bitwarden-cli.${{ PACKAGE_VERSION }}.nupkg + path: ./dist/chocolatey/bitwarden-cli.${{ PACKAGE_VERSION }}.nupkg publish_windows: From 7a0dcb630559564d13b9f1f87077168f412c932a Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Wed, 23 Dec 2020 19:20:53 +0000 Subject: [PATCH 18/22] adding an env transfer --- .github/workflows/build.yml | 42 ++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 927b8fc17d..84199a860e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -111,44 +111,58 @@ jobs: - name: Publish windows zip to GitHub uses: actions/upload-artifact@v2 with: - name: bw-windows-${{ PACKAGE_VERSION }}.zip - path: ./dist/bw-windows-${{ PACKAGE_VERSION }}.zip + name: bw-windows-${{ env.pkg-version }}.zip + path: ./dist/bw-windows-${{ env.pkg-version }}.zip + env: + pkg-version: $PACKAGE_VERSION - name: Publish windows checksum to GitHub uses: actions/upload-artifact@v2 with: - name: bw-windows-sha256-${{ PACKAGE_VERSION }}.txt - path: ./dist/bw-windows-sha256-${{ PACKAGE_VERSION }}.txt + name: bw-windows-sha256-${{ env.pkg-version }}.txt + path: ./dist/bw-windows-sha256-${{ env.pkg-version }}.txt + env: + pkg-version: $PACKAGE_VERSION - name: Publish macos zip to GitHub uses: actions/upload-artifact@v2 with: - name: bw-macos-${{ PACKAGE_VERSION }}.zip - path: ./dist/bw-macos-${{ PACKAGE_VERSION }}.zip + name: bw-macos-${{ env.pkg-version }}.zip + path: ./dist/bw-macos-${{ env.pkg-version }}.zip + env: + pkg-version: $PACKAGE_VERSION - name: Publish macos checksum to GitHub uses: actions/upload-artifact@v2 with: - name: bw-macos-sha256-${{ PACKAGE_VERSION }}.txt - path: ./dist/bw-macos-sha256-${{ PACKAGE_VERSION }}.txt + name: bw-macos-sha256-${{ env.pkg-version }}.txt + path: ./dist/bw-macos-sha256-${{ env.pkg-version }}.txt + env: + pkg-version: $PACKAGE_VERSION - name: Publish linux zip to GitHub uses: actions/upload-artifact@v2 with: - name: bw-linux-${{ PACKAGE_VERSION }}.zip - path: ./dist/bw-linux-${{ PACKAGE_VERSION }}.zip + name: bw-linux-${{ env.pkg-version }}.zip + path: ./dist/bw-linux-${{ env.pkg-version }}.zip + env: + pkg-version: $PACKAGE_VERSION - name: Publish linux checksum to GitHub uses: actions/upload-artifact@v2 with: - name: bw-linux-sha256-${{ PACKAGE_VERSION }}.txt - path: ./dist/bw-linux-sha256-${{ PACKAGE_VERSION }}.txt + name: bw-linux-sha256-${{ env.pkg-version }}.txt + path: ./dist/bw-linux-sha256-${{ env.pkg-version }}.txt + env: + pkg-version: $PACKAGE_VERSION - name: Publish Chocolatey CLI uses: actions/upload-artifact@v2 with: - name: bitwarden-cli.${{ PACKAGE_VERSION }}.nupkg - path: ./dist/chocolatey/bitwarden-cli.${{ PACKAGE_VERSION }}.nupkg + name: bitwarden-cli.${{ env.pkg-version }}.nupkg + path: ./dist/chocolatey/bitwarden-cli.${{ env.pkg-version }}.nupkg + env: + pkg-version: $PACKAGE_VERSION publish_windows: From 169d94b9fb77c3ec77b35bbe3e88be8520217a1a Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Wed, 23 Dec 2020 19:31:45 +0000 Subject: [PATCH 19/22] more debugging --- .github/workflows/build.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 84199a860e..c83e696cb7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -114,7 +114,7 @@ jobs: name: bw-windows-${{ env.pkg-version }}.zip path: ./dist/bw-windows-${{ env.pkg-version }}.zip env: - pkg-version: $PACKAGE_VERSION + pkg-version: ${PACKAGE_VERSION} - name: Publish windows checksum to GitHub uses: actions/upload-artifact@v2 @@ -122,7 +122,7 @@ jobs: name: bw-windows-sha256-${{ env.pkg-version }}.txt path: ./dist/bw-windows-sha256-${{ env.pkg-version }}.txt env: - pkg-version: $PACKAGE_VERSION + pkg-version: ${PACKAGE_VERSION} - name: Publish macos zip to GitHub uses: actions/upload-artifact@v2 @@ -130,7 +130,7 @@ jobs: name: bw-macos-${{ env.pkg-version }}.zip path: ./dist/bw-macos-${{ env.pkg-version }}.zip env: - pkg-version: $PACKAGE_VERSION + pkg-version: ${PACKAGE_VERSION} - name: Publish macos checksum to GitHub uses: actions/upload-artifact@v2 @@ -138,7 +138,7 @@ jobs: name: bw-macos-sha256-${{ env.pkg-version }}.txt path: ./dist/bw-macos-sha256-${{ env.pkg-version }}.txt env: - pkg-version: $PACKAGE_VERSION + pkg-version: ${PACKAGE_VERSION} - name: Publish linux zip to GitHub uses: actions/upload-artifact@v2 @@ -146,7 +146,7 @@ jobs: name: bw-linux-${{ env.pkg-version }}.zip path: ./dist/bw-linux-${{ env.pkg-version }}.zip env: - pkg-version: $PACKAGE_VERSION + pkg-version: ${PACKAGE_VERSION} - name: Publish linux checksum to GitHub uses: actions/upload-artifact@v2 @@ -154,7 +154,7 @@ jobs: name: bw-linux-sha256-${{ env.pkg-version }}.txt path: ./dist/bw-linux-sha256-${{ env.pkg-version }}.txt env: - pkg-version: $PACKAGE_VERSION + pkg-version: ${PACKAGE_VERSION} - name: Publish Chocolatey CLI uses: actions/upload-artifact@v2 @@ -162,7 +162,7 @@ jobs: name: bitwarden-cli.${{ env.pkg-version }}.nupkg path: ./dist/chocolatey/bitwarden-cli.${{ env.pkg-version }}.nupkg env: - pkg-version: $PACKAGE_VERSION + pkg-version: ${PACKAGE_VERSION} publish_windows: From 18031b80f028005984b0a2ee11c5d3677dd2eca5 Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Wed, 23 Dec 2020 19:45:23 +0000 Subject: [PATCH 20/22] trying the env.* syntax --- .github/workflows/build.yml | 42 +++++++++++++------------------------ 1 file changed, 14 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c83e696cb7..534ea4f308 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -111,58 +111,44 @@ jobs: - name: Publish windows zip to GitHub uses: actions/upload-artifact@v2 with: - name: bw-windows-${{ env.pkg-version }}.zip - path: ./dist/bw-windows-${{ env.pkg-version }}.zip - env: - pkg-version: ${PACKAGE_VERSION} + name: bw-windows-${{ env.PACKAGE_NAME }}.zip + path: ./dist/bw-windows-${{ env.PACKAGE_NAME }}.zip - name: Publish windows checksum to GitHub uses: actions/upload-artifact@v2 with: - name: bw-windows-sha256-${{ env.pkg-version }}.txt - path: ./dist/bw-windows-sha256-${{ env.pkg-version }}.txt - env: - pkg-version: ${PACKAGE_VERSION} + name: bw-windows-sha256-${{ env.PACKAGE_NAME }}.txt + path: ./dist/bw-windows-sha256-${{ env.PACKAGE_NAME }}.txt - name: Publish macos zip to GitHub uses: actions/upload-artifact@v2 with: - name: bw-macos-${{ env.pkg-version }}.zip - path: ./dist/bw-macos-${{ env.pkg-version }}.zip - env: - pkg-version: ${PACKAGE_VERSION} + name: bw-macos-${{ env.PACKAGE_NAME }}.zip + path: ./dist/bw-macos-${{ env.PACKAGE_NAME }}.zip - name: Publish macos checksum to GitHub uses: actions/upload-artifact@v2 with: - name: bw-macos-sha256-${{ env.pkg-version }}.txt - path: ./dist/bw-macos-sha256-${{ env.pkg-version }}.txt - env: - pkg-version: ${PACKAGE_VERSION} + name: bw-macos-sha256-${{ env.PACKAGE_NAME }}.txt + path: ./dist/bw-macos-sha256-${{ env.PACKAGE_NAME }}.txt - name: Publish linux zip to GitHub uses: actions/upload-artifact@v2 with: - name: bw-linux-${{ env.pkg-version }}.zip - path: ./dist/bw-linux-${{ env.pkg-version }}.zip - env: - pkg-version: ${PACKAGE_VERSION} + name: bw-linux-${{ env.PACKAGE_NAME }}.zip + path: ./dist/bw-linux-${{ env.PACKAGE_NAME }}.zip - name: Publish linux checksum to GitHub uses: actions/upload-artifact@v2 with: - name: bw-linux-sha256-${{ env.pkg-version }}.txt - path: ./dist/bw-linux-sha256-${{ env.pkg-version }}.txt - env: - pkg-version: ${PACKAGE_VERSION} + name: bw-linux-sha256-${{ env.PACKAGE_NAME }}.txt + path: ./dist/bw-linux-sha256-${{ env.PACKAGE_NAME }}.txt - name: Publish Chocolatey CLI uses: actions/upload-artifact@v2 with: - name: bitwarden-cli.${{ env.pkg-version }}.nupkg - path: ./dist/chocolatey/bitwarden-cli.${{ env.pkg-version }}.nupkg - env: - pkg-version: ${PACKAGE_VERSION} + name: bitwarden-cli.${{ env.PACKAGE_NAME }}.nupkg + path: ./dist/chocolatey/bitwarden-cli.${{ env.PACKAGE_NAME }}.nupkg publish_windows: From 184f46cd8b2a57d8ca20f99efdc9cdc524cd835e Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Wed, 23 Dec 2020 19:54:01 +0000 Subject: [PATCH 21/22] fixing the env var for publishing --- .github/workflows/build.yml | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 534ea4f308..9b4579638e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -105,50 +105,47 @@ 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: Debug Files - run: dir ./dist - - name: Publish windows zip to GitHub uses: actions/upload-artifact@v2 with: - name: bw-windows-${{ env.PACKAGE_NAME }}.zip - path: ./dist/bw-windows-${{ env.PACKAGE_NAME }}.zip + name: bw-windows-${{ env.PACKAGE_VERSION }}.zip + path: ./dist/bw-windows-${{ env.PACKAGE_VERSION }}.zip - name: Publish windows checksum to GitHub uses: actions/upload-artifact@v2 with: - name: bw-windows-sha256-${{ env.PACKAGE_NAME }}.txt - path: ./dist/bw-windows-sha256-${{ env.PACKAGE_NAME }}.txt + name: bw-windows-sha256-${{ env.PACKAGE_VERSION }}.txt + path: ./dist/bw-windows-sha256-${{ env.PACKAGE_VERSION }}.txt - name: Publish macos zip to GitHub uses: actions/upload-artifact@v2 with: - name: bw-macos-${{ env.PACKAGE_NAME }}.zip - path: ./dist/bw-macos-${{ env.PACKAGE_NAME }}.zip + name: bw-macos-${{ env.PACKAGE_VERSION }}.zip + path: ./dist/bw-macos-${{ env.PACKAGE_VERSION }}.zip - name: Publish macos checksum to GitHub uses: actions/upload-artifact@v2 with: - name: bw-macos-sha256-${{ env.PACKAGE_NAME }}.txt - path: ./dist/bw-macos-sha256-${{ env.PACKAGE_NAME }}.txt + name: bw-macos-sha256-${{ env.PACKAGE_VERSION }}.txt + path: ./dist/bw-macos-sha256-${{ env.PACKAGE_VERSION }}.txt - name: Publish linux zip to GitHub uses: actions/upload-artifact@v2 with: - name: bw-linux-${{ env.PACKAGE_NAME }}.zip - path: ./dist/bw-linux-${{ env.PACKAGE_NAME }}.zip + name: bw-linux-${{ env.PACKAGE_VERSION }}.zip + path: ./dist/bw-linux-${{ env.PACKAGE_VERSION }}.zip - name: Publish linux checksum to GitHub uses: actions/upload-artifact@v2 with: - name: bw-linux-sha256-${{ env.PACKAGE_NAME }}.txt - path: ./dist/bw-linux-sha256-${{ env.PACKAGE_NAME }}.txt + name: bw-linux-sha256-${{ env.PACKAGE_VERSION }}.txt + path: ./dist/bw-linux-sha256-${{ env.PACKAGE_VERSION }}.txt - name: Publish Chocolatey CLI uses: actions/upload-artifact@v2 with: - name: bitwarden-cli.${{ env.PACKAGE_NAME }}.nupkg - path: ./dist/chocolatey/bitwarden-cli.${{ env.PACKAGE_NAME }}.nupkg + name: bitwarden-cli.${{ env.PACKAGE_VERSION }}.nupkg + path: ./dist/chocolatey/bitwarden-cli.${{ env.PACKAGE_VERSION }}.nupkg publish_windows: From 2b44a3897d4595da6391c62a3141614d8f5abdde Mon Sep 17 00:00:00 2001 From: Joseph Flinn Date: Wed, 6 Jan 2021 19:26:25 +0000 Subject: [PATCH 22/22] adding an experimental workflow to test the windows environment on for the ResourceHacker --- .github/workflows/build.yml | 33 ++++++++++++++++++++++++--------- .github/workflows/exp.yml | 11 +++++++++++ 2 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/exp.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9b4579638e..77d4ee9f14 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,13 +1,15 @@ name: build & publish on: - push: - branches-ignore: - - 'l10n_master' - release: - types: - - published + workflow_dispatch: +#on: +# push: +# branches-ignore: +# - 'l10n_master' +# release: +# types: +# - published jobs: cloc: @@ -22,8 +24,7 @@ jobs: sudo apt -y install cloc - name: Print lines of code - run: cloc --include-lang TypeScript,JavaScript,HTML,Sass,CSS --vcs git - + run: cloc --include-lang TypeScript,JavaScript --vcs git build: name: Build CLI @@ -40,12 +41,18 @@ jobs: with: node-version: '10.x' - - name: Set PACKAGE_VERSION + - name: Set PACKAGE_VERSION & VER_INFO 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 "version: $env:pkgVersion" + if(Test-Path -Path $env:WIN_PKG) { + echo "VER_INFO=true" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } + env: + WIN_PKG: C:\Users\appveyor\.pkg-cache\v2.5\fetched-v10.4.1-win-x64 + - name: test setting env var run: | echo "version: $env:PACKAGE_VERSION" @@ -54,6 +61,14 @@ jobs: Throw "test env failed." } + - name: + + - name: ResourceHacker + run: | + if defined VER_INFO ResourceHacker -open %WIN_PKG% -save %WIN_PKG% -action delete -mask ICONGROUP,1, + if defined VER_INFO ResourceHacker -open version-info.rc -save version-info.res -action compile + if defined VER_INFO ResourceHacker -open %WIN_PKG% -save %WIN_PKG% -action addoverwrite -resource version-info.res + - name: Install run: npm install diff --git a/.github/workflows/exp.yml b/.github/workflows/exp.yml new file mode 100644 index 0000000000..1f6e1244ea --- /dev/null +++ b/.github/workflows/exp.yml @@ -0,0 +1,11 @@ +name: Windows Environment Exploration + +on: + workflow_dispatch: + +jobs: + exp: + runs-on: ubuntu-latest + steps: + - name: Test pkg + run: pkg --help