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:
|
||||
name: Build CLI
|
||||
runs-on: windows-2019
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-20.04, windows-2019, macos-11]
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs:
|
||||
- setup
|
||||
env:
|
||||
@ -78,7 +81,15 @@ jobs:
|
||||
- name: Checkout repo
|
||||
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
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
choco install checksum --no-progress
|
||||
choco install reshack --no-progress
|
||||
@ -98,6 +109,7 @@ jobs:
|
||||
|
||||
- name: Get pkg-fetch
|
||||
shell: pwsh
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
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"
|
||||
@ -108,6 +120,7 @@ jobs:
|
||||
|
||||
- name: Setup Version Info
|
||||
shell: pwsh
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
$major,$minor,$patch = $env:_PACKAGE_VERSION.split('.')
|
||||
$versionInfo = @"
|
||||
@ -142,6 +155,7 @@ jobs:
|
||||
|
||||
- name: Resource Hacker
|
||||
shell: cmd
|
||||
if: runner.os == 'Windows'
|
||||
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
|
||||
@ -155,25 +169,36 @@ jobs:
|
||||
run: npm ci
|
||||
working-directory: ./
|
||||
|
||||
- name: Build & Package
|
||||
run: npm run dist --quiet
|
||||
- name: Build & Package Windows
|
||||
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
|
||||
shell: pwsh
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
Copy-Item -Path stores/chocolatey -Destination dist/chocolatey -Recurse
|
||||
Copy-Item dist/windows/bw.exe -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
|
||||
|
||||
- name: Zip
|
||||
- name: Zip Windows
|
||||
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: |
|
||||
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
|
||||
cd ./dist/${{ env.LOWER_RUNNER_OS }}
|
||||
zip ../bw-${{ env.LOWER_RUNNER_OS }}-${{ env._PACKAGE_VERSION }}.zip ./bw
|
||||
|
||||
- name: Version Test
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
dir ./dist/
|
||||
Expand-Archive -Path "./dist/bw-windows-${env:_PACKAGE_VERSION}.zip" -DestinationPath "./test/windows"
|
||||
@ -184,16 +209,21 @@ jobs:
|
||||
Throw "Version test failed."
|
||||
}
|
||||
|
||||
- name: Create checksums
|
||||
- name: Create checksums Windows
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
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: Create checksums Unix
|
||||
if: runner.os != 'Windows'
|
||||
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
|
||||
if: runner.os == 'Windows'
|
||||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
||||
with:
|
||||
name: bw-windows-${{ env._PACKAGE_VERSION }}.zip
|
||||
@ -201,41 +231,31 @@ jobs:
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload windows checksum asset
|
||||
if: runner.os == 'Windows'
|
||||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
||||
with:
|
||||
name: bw-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||
path: apps/cli/dist/bw-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||
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
|
||||
with:
|
||||
name: bw-macos-${{ env._PACKAGE_VERSION }}.zip
|
||||
path: apps/cli/dist/bw-macos-${{ env._PACKAGE_VERSION }}.zip
|
||||
name: bw-${{ env.LOWER_RUNNER_OS }}-${{ env._PACKAGE_VERSION }}.zip
|
||||
path: apps/cli/dist/bw-${{ env.LOWER_RUNNER_OS }}-${{ env._PACKAGE_VERSION }}.zip
|
||||
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
|
||||
with:
|
||||
name: bw-macos-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||
path: apps/cli/dist/bw-macos-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
|
||||
name: bw-${{ env.LOWER_RUNNER_OS }}-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 Chocolatey asset
|
||||
if: runner.os == 'Windows'
|
||||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
||||
with:
|
||||
name: bitwarden-cli.${{ env._PACKAGE_VERSION }}.nupkg
|
||||
@ -243,6 +263,7 @@ jobs:
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload NPM Build Directory asset
|
||||
if: runner.os == 'Windows'
|
||||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
||||
with:
|
||||
name: bitwarden-cli-${{ env._PACKAGE_VERSION }}-npm-build.zip
|
||||
|
@ -41,11 +41,15 @@
|
||||
"bw": "build/bw.js"
|
||||
},
|
||||
"pkg": {
|
||||
"assets": "./build/**/*"
|
||||
"assets": [
|
||||
"./build/**/*",
|
||||
"../../node_modules/argon2/**/*"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"@koa/multer": "^3.0.0",
|
||||
"@koa/router": "^10.1.1",
|
||||
"argon2": "^0.30.3",
|
||||
"big-integer": "^1.6.51",
|
||||
"browser-hrtime": "^1.1.8",
|
||||
"chalk": "^4.1.1",
|
||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -191,6 +191,7 @@
|
||||
"dependencies": {
|
||||
"@koa/multer": "^3.0.0",
|
||||
"@koa/router": "^10.1.1",
|
||||
"argon2": "^0.30.3",
|
||||
"big-integer": "^1.6.51",
|
||||
"browser-hrtime": "^1.1.8",
|
||||
"chalk": "^4.1.1",
|
||||
@ -45252,6 +45253,7 @@
|
||||
"requires": {
|
||||
"@koa/multer": "^3.0.0",
|
||||
"@koa/router": "^10.1.1",
|
||||
"argon2": "^0.30.3",
|
||||
"big-integer": "^1.6.51",
|
||||
"browser-hrtime": "^1.1.8",
|
||||
"chalk": "^4.1.1",
|
||||
|
Loading…
Reference in New Issue
Block a user