mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-22 11:45:59 +01:00
[PS-2367] CLI pkg ref for argon2 lib (#4579)
* pkg ref argon2 * add argon to cli package.json * argon2 assets * ci matrix for cli * simplify builds for testing * fix env * zip for each os * add os prefix back to zip * create checksums * make sums 256 * fix shasum command * combine some steps for unix * LOWER_RUNNER_OS * SHORT_RUNNER_OS * SHORT_RUNNER_OS on dist * upload unix assets * restore old build files * fix formatting * fix zip folder structure * fix condition on upload unix zip asset * compute shasum like other parts of build * change matrix os targets
This commit is contained in:
parent
b7a5c2731d
commit
61d94c7e59
85
.github/workflows/build-cli.yml
vendored
85
.github/workflows/build-cli.yml
vendored
@ -67,7 +67,10 @@ jobs:
|
|||||||
|
|
||||||
cli:
|
cli:
|
||||||
name: Build CLI
|
name: Build CLI
|
||||||
runs-on: windows-2019
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ubuntu-20.04, windows-2019, macos-11]
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
needs:
|
needs:
|
||||||
- setup
|
- setup
|
||||||
env:
|
env:
|
||||||
@ -78,7 +81,15 @@ jobs:
|
|||||||
- name: Checkout repo
|
- name: Checkout repo
|
||||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
||||||
|
|
||||||
|
- name: Setup Unix Vars
|
||||||
|
if: runner.os != 'Windows'
|
||||||
|
run: |
|
||||||
|
echo "LOWER_RUNNER_OS=$(echo $RUNNER_OS | awk '{print tolower($0)}')" >> $GITHUB_ENV
|
||||||
|
echo "SHORT_RUNNER_OS=$(echo $RUNNER_OS | awk '{print substr($0, 1, 3)}' | \
|
||||||
|
awk '{print tolower($0)}')" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Setup Windows builder
|
- name: Setup Windows builder
|
||||||
|
if: runner.os == 'Windows'
|
||||||
run: |
|
run: |
|
||||||
choco install checksum --no-progress
|
choco install checksum --no-progress
|
||||||
choco install reshack --no-progress
|
choco install reshack --no-progress
|
||||||
@ -98,6 +109,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Get pkg-fetch
|
- name: Get pkg-fetch
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
if: runner.os == 'Windows'
|
||||||
run: |
|
run: |
|
||||||
cd $HOME
|
cd $HOME
|
||||||
$fetchedUrl = "https://github.com/vercel/pkg-fetch/releases/download/v$env:_WIN_PKG_VERSION/node-v$env:_WIN_PKG_FETCH_VERSION-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"
|
||||||
@ -108,6 +120,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Setup Version Info
|
- name: Setup Version Info
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
if: runner.os == 'Windows'
|
||||||
run: |
|
run: |
|
||||||
$major,$minor,$patch = $env:_PACKAGE_VERSION.split('.')
|
$major,$minor,$patch = $env:_PACKAGE_VERSION.split('.')
|
||||||
$versionInfo = @"
|
$versionInfo = @"
|
||||||
@ -142,6 +155,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Resource Hacker
|
- name: Resource Hacker
|
||||||
shell: cmd
|
shell: cmd
|
||||||
|
if: runner.os == 'Windows'
|
||||||
run: |
|
run: |
|
||||||
set PATH=%PATH%;C:\Program Files (x86)\Resource Hacker
|
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=C:\Users\runneradmin\.pkg-cache\v%_WIN_PKG_VERSION%\fetched-v%_WIN_PKG_FETCH_VERSION%-win-x64
|
||||||
@ -155,25 +169,36 @@ jobs:
|
|||||||
run: npm ci
|
run: npm ci
|
||||||
working-directory: ./
|
working-directory: ./
|
||||||
|
|
||||||
- name: Build & Package
|
- name: Build & Package Windows
|
||||||
run: npm run dist --quiet
|
if: runner.os == 'Windows'
|
||||||
|
run: npm run dist:win --quiet
|
||||||
|
|
||||||
|
- name: Build & Package Unix
|
||||||
|
if: runner.os != 'Windows'
|
||||||
|
run: npm run dist:${{ env.SHORT_RUNNER_OS }} --quiet
|
||||||
|
|
||||||
- name: Package Chocolatey
|
- name: Package Chocolatey
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
if: runner.os == 'Windows'
|
||||||
run: |
|
run: |
|
||||||
Copy-Item -Path stores/chocolatey -Destination dist/chocolatey -Recurse
|
Copy-Item -Path stores/chocolatey -Destination dist/chocolatey -Recurse
|
||||||
Copy-Item dist/windows/bw.exe -Destination dist/chocolatey/tools
|
Copy-Item dist/windows/bw.exe -Destination dist/chocolatey/tools
|
||||||
Copy-Item ${{ github.workspace }}/LICENSE.txt -Destination dist/chocolatey/tools
|
Copy-Item ${{ github.workspace }}/LICENSE.txt -Destination dist/chocolatey/tools
|
||||||
choco pack dist/chocolatey/bitwarden-cli.nuspec --version ${{ env._PACKAGE_VERSION }} --out dist/chocolatey
|
choco pack dist/chocolatey/bitwarden-cli.nuspec --version ${{ env._PACKAGE_VERSION }} --out dist/chocolatey
|
||||||
|
|
||||||
- name: Zip
|
- name: Zip Windows
|
||||||
shell: cmd
|
shell: cmd
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
run: 7z a ./dist/bw-windows-%_PACKAGE_VERSION%.zip ./dist/windows/bw.exe
|
||||||
|
|
||||||
|
- name: Zip Unix
|
||||||
|
if: runner.os != 'Windows'
|
||||||
run: |
|
run: |
|
||||||
7z a ./dist/bw-windows-%_PACKAGE_VERSION%.zip ./dist/windows/bw.exe
|
cd ./dist/${{ env.LOWER_RUNNER_OS }}
|
||||||
7z a ./dist/bw-macos-%_PACKAGE_VERSION%.zip ./dist/macos/bw
|
zip ../bw-${{ env.LOWER_RUNNER_OS }}-${{ env._PACKAGE_VERSION }}.zip ./bw
|
||||||
7z a ./dist/bw-linux-%_PACKAGE_VERSION%.zip ./dist/linux/bw
|
|
||||||
|
|
||||||
- name: Version Test
|
- name: Version Test
|
||||||
|
if: runner.os == 'Windows'
|
||||||
run: |
|
run: |
|
||||||
dir ./dist/
|
dir ./dist/
|
||||||
Expand-Archive -Path "./dist/bw-windows-${env:_PACKAGE_VERSION}.zip" -DestinationPath "./test/windows"
|
Expand-Archive -Path "./dist/bw-windows-${env:_PACKAGE_VERSION}.zip" -DestinationPath "./test/windows"
|
||||||
@ -184,16 +209,21 @@ jobs:
|
|||||||
Throw "Version test failed."
|
Throw "Version test failed."
|
||||||
}
|
}
|
||||||
|
|
||||||
- name: Create checksums
|
- name: Create checksums Windows
|
||||||
|
if: runner.os == 'Windows'
|
||||||
run: |
|
run: |
|
||||||
checksum -f="./dist/bw-windows-${env:_PACKAGE_VERSION}.zip" `
|
checksum -f="./dist/bw-windows-${env:_PACKAGE_VERSION}.zip" `
|
||||||
-t sha256 | Out-File -Encoding ASCII ./dist/bw-windows-sha256-${env:_PACKAGE_VERSION}.txt
|
-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
|
- name: Create checksums Unix
|
||||||
checksum -f="./dist/bw-linux-${env:_PACKAGE_VERSION}.zip" `
|
if: runner.os != 'Windows'
|
||||||
-t sha256 | Out-File -Encoding ASCII ./dist/bw-linux-sha256-${env:_PACKAGE_VERSION}.txt
|
run: |
|
||||||
|
cd ./dist
|
||||||
|
sha256sum bw-${{ env.LOWER_RUNNER_OS }}-${{ env._PACKAGE_VERSION }}.zip \
|
||||||
|
| awk '{split($0, a); print a[1]}' > bw-${{ env.LOWER_RUNNER_OS }}-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||||
|
|
||||||
- name: Upload windows zip asset
|
- name: Upload windows zip asset
|
||||||
|
if: runner.os == 'Windows'
|
||||||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
||||||
with:
|
with:
|
||||||
name: bw-windows-${{ env._PACKAGE_VERSION }}.zip
|
name: bw-windows-${{ env._PACKAGE_VERSION }}.zip
|
||||||
@ -201,41 +231,31 @@ jobs:
|
|||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload windows checksum asset
|
- name: Upload windows checksum asset
|
||||||
|
if: runner.os == 'Windows'
|
||||||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
||||||
with:
|
with:
|
||||||
name: bw-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
|
name: bw-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||||
path: apps/cli/dist/bw-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
|
path: apps/cli/dist/bw-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload macos zip asset
|
- name: Upload unix zip asset
|
||||||
|
if: runner.os != 'Windows'
|
||||||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
||||||
with:
|
with:
|
||||||
name: bw-macos-${{ env._PACKAGE_VERSION }}.zip
|
name: bw-${{ env.LOWER_RUNNER_OS }}-${{ env._PACKAGE_VERSION }}.zip
|
||||||
path: apps/cli/dist/bw-macos-${{ env._PACKAGE_VERSION }}.zip
|
path: apps/cli/dist/bw-${{ env.LOWER_RUNNER_OS }}-${{ env._PACKAGE_VERSION }}.zip
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload macos checksum asset
|
- name: Upload unix checksum asset
|
||||||
|
if: runner.os != 'Windows'
|
||||||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
||||||
with:
|
with:
|
||||||
name: bw-macos-sha256-${{ env._PACKAGE_VERSION }}.txt
|
name: bw-${{ env.LOWER_RUNNER_OS }}-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||||
path: apps/cli/dist/bw-macos-sha256-${{ env._PACKAGE_VERSION }}.txt
|
path: apps/cli/dist/bw-${{ env.LOWER_RUNNER_OS }}-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
- name: Upload linux zip asset
|
|
||||||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
|
||||||
with:
|
|
||||||
name: bw-linux-${{ env._PACKAGE_VERSION }}.zip
|
|
||||||
path: apps/cli/dist/bw-linux-${{ env._PACKAGE_VERSION }}.zip
|
|
||||||
if-no-files-found: error
|
|
||||||
|
|
||||||
- name: Upload linux checksum asset
|
|
||||||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
|
||||||
with:
|
|
||||||
name: bw-linux-sha256-${{ env._PACKAGE_VERSION }}.txt
|
|
||||||
path: apps/cli/dist/bw-linux-sha256-${{ env._PACKAGE_VERSION }}.txt
|
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload Chocolatey asset
|
- name: Upload Chocolatey asset
|
||||||
|
if: runner.os == 'Windows'
|
||||||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
||||||
with:
|
with:
|
||||||
name: bitwarden-cli.${{ env._PACKAGE_VERSION }}.nupkg
|
name: bitwarden-cli.${{ env._PACKAGE_VERSION }}.nupkg
|
||||||
@ -243,6 +263,7 @@ jobs:
|
|||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload NPM Build Directory asset
|
- name: Upload NPM Build Directory asset
|
||||||
|
if: runner.os == 'Windows'
|
||||||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
||||||
with:
|
with:
|
||||||
name: bitwarden-cli-${{ env._PACKAGE_VERSION }}-npm-build.zip
|
name: bitwarden-cli-${{ env._PACKAGE_VERSION }}-npm-build.zip
|
||||||
|
@ -41,11 +41,15 @@
|
|||||||
"bw": "build/bw.js"
|
"bw": "build/bw.js"
|
||||||
},
|
},
|
||||||
"pkg": {
|
"pkg": {
|
||||||
"assets": "./build/**/*"
|
"assets": [
|
||||||
|
"./build/**/*",
|
||||||
|
"../../node_modules/argon2/**/*"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@koa/multer": "^3.0.0",
|
"@koa/multer": "^3.0.0",
|
||||||
"@koa/router": "^10.1.1",
|
"@koa/router": "^10.1.1",
|
||||||
|
"argon2": "^0.30.3",
|
||||||
"big-integer": "^1.6.51",
|
"big-integer": "^1.6.51",
|
||||||
"browser-hrtime": "^1.1.8",
|
"browser-hrtime": "^1.1.8",
|
||||||
"chalk": "^4.1.1",
|
"chalk": "^4.1.1",
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -191,6 +191,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@koa/multer": "^3.0.0",
|
"@koa/multer": "^3.0.0",
|
||||||
"@koa/router": "^10.1.1",
|
"@koa/router": "^10.1.1",
|
||||||
|
"argon2": "^0.30.3",
|
||||||
"big-integer": "^1.6.51",
|
"big-integer": "^1.6.51",
|
||||||
"browser-hrtime": "^1.1.8",
|
"browser-hrtime": "^1.1.8",
|
||||||
"chalk": "^4.1.1",
|
"chalk": "^4.1.1",
|
||||||
@ -45252,6 +45253,7 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"@koa/multer": "^3.0.0",
|
"@koa/multer": "^3.0.0",
|
||||||
"@koa/router": "^10.1.1",
|
"@koa/router": "^10.1.1",
|
||||||
|
"argon2": "^0.30.3",
|
||||||
"big-integer": "^1.6.51",
|
"big-integer": "^1.6.51",
|
||||||
"browser-hrtime": "^1.1.8",
|
"browser-hrtime": "^1.1.8",
|
||||||
"chalk": "^4.1.1",
|
"chalk": "^4.1.1",
|
||||||
|
Loading…
Reference in New Issue
Block a user