mirror of
https://github.com/bitwarden/browser.git
synced 2025-01-02 18:17:46 +01:00
[DEVOPS-1185] Split out the windows os from the new cli matrix build (#4673)
* Split *nix and windows cli builds * Fix * fix * Add ls * FIx * FIx * FIx
This commit is contained in:
parent
da963346db
commit
6a7a7299c2
120
.github/workflows/build-cli.yml
vendored
120
.github/workflows/build-cli.yml
vendored
@ -66,10 +66,10 @@ jobs:
|
|||||||
|
|
||||||
|
|
||||||
cli:
|
cli:
|
||||||
name: Build CLI
|
name: Build CLI ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-20.04, windows-2019, macos-11]
|
os: [ubuntu-20.04, macos-11]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
needs:
|
needs:
|
||||||
- setup
|
- setup
|
||||||
@ -82,14 +82,80 @@ jobs:
|
|||||||
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
||||||
|
|
||||||
- name: Setup Unix Vars
|
- name: Setup Unix Vars
|
||||||
if: runner.os != 'Windows'
|
|
||||||
run: |
|
run: |
|
||||||
echo "LOWER_RUNNER_OS=$(echo $RUNNER_OS | awk '{print tolower($0)}')" >> $GITHUB_ENV
|
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)}' | \
|
echo "SHORT_RUNNER_OS=$(echo $RUNNER_OS | awk '{print substr($0, 1, 3)}' | \
|
||||||
awk '{print tolower($0)}')" >> $GITHUB_ENV
|
awk '{print tolower($0)}')" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Set up Node
|
||||||
|
uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # v3.2.0
|
||||||
|
with:
|
||||||
|
cache: 'npm'
|
||||||
|
cache-dependency-path: '**/package-lock.json'
|
||||||
|
node-version: '16'
|
||||||
|
|
||||||
|
- name: Install node-gyp
|
||||||
|
run: |
|
||||||
|
npm install -g node-gyp
|
||||||
|
node-gyp install $(node -v)
|
||||||
|
|
||||||
|
- name: Install
|
||||||
|
run: npm ci
|
||||||
|
working-directory: ./
|
||||||
|
|
||||||
|
- name: Build & Package Unix
|
||||||
|
run: npm run dist:${{ env.SHORT_RUNNER_OS }} --quiet
|
||||||
|
|
||||||
|
- name: Zip Unix
|
||||||
|
run: |
|
||||||
|
cd ./dist/${{ env.LOWER_RUNNER_OS }}
|
||||||
|
zip ../bw-${{ env.LOWER_RUNNER_OS }}-${{ env._PACKAGE_VERSION }}.zip ./bw
|
||||||
|
|
||||||
|
- name: Version Test
|
||||||
|
run: |
|
||||||
|
unzip "./dist/bw-${{ env.LOWER_RUNNER_OS }}-${{ env._PACKAGE_VERSION }}.zip" -d "./test"
|
||||||
|
testVersion=$(./test/bw -v)
|
||||||
|
echo "version: $_PACKAGE_VERSION"
|
||||||
|
echo "testVersion: $testVersion"
|
||||||
|
if [[ $testVersion != $_PACKAGE_VERSION ]]; then
|
||||||
|
echo "Version test failed."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Create checksums Unix
|
||||||
|
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 unix zip asset
|
||||||
|
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
||||||
|
with:
|
||||||
|
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 unix checksum asset
|
||||||
|
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
||||||
|
with:
|
||||||
|
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
|
||||||
|
|
||||||
|
cli-windows:
|
||||||
|
name: Build CLI Windows
|
||||||
|
runs-on: windows-2019
|
||||||
|
needs:
|
||||||
|
- setup
|
||||||
|
env:
|
||||||
|
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
|
||||||
|
_WIN_PKG_FETCH_VERSION: 16.16.0
|
||||||
|
_WIN_PKG_VERSION: 3.4
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
|
||||||
|
|
||||||
- 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
|
||||||
@ -109,7 +175,6 @@ 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"
|
||||||
@ -120,7 +185,6 @@ 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 = @"
|
||||||
@ -155,7 +219,6 @@ 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
|
||||||
@ -170,16 +233,10 @@ jobs:
|
|||||||
working-directory: ./
|
working-directory: ./
|
||||||
|
|
||||||
- name: Build & Package Windows
|
- name: Build & Package Windows
|
||||||
if: runner.os == 'Windows'
|
|
||||||
run: npm run dist:win --quiet
|
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
|
||||||
@ -188,17 +245,9 @@ jobs:
|
|||||||
|
|
||||||
- name: Zip Windows
|
- name: Zip Windows
|
||||||
shell: cmd
|
shell: cmd
|
||||||
if: runner.os == 'Windows'
|
|
||||||
run: 7z a ./dist/bw-windows-%_PACKAGE_VERSION%.zip ./dist/windows/bw.exe
|
run: 7z a ./dist/bw-windows-%_PACKAGE_VERSION%.zip ./dist/windows/bw.exe
|
||||||
|
|
||||||
- name: Zip Unix
|
|
||||||
if: runner.os != 'Windows'
|
|
||||||
run: |
|
|
||||||
cd ./dist/${{ env.LOWER_RUNNER_OS }}
|
|
||||||
zip ../bw-${{ env.LOWER_RUNNER_OS }}-${{ env._PACKAGE_VERSION }}.zip ./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"
|
||||||
@ -210,20 +259,11 @@ jobs:
|
|||||||
}
|
}
|
||||||
|
|
||||||
- name: Create checksums Windows
|
- 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
|
||||||
|
|
||||||
- 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
|
- 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
|
||||||
@ -231,31 +271,13 @@ 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 unix zip asset
|
|
||||||
if: runner.os != 'Windows'
|
|
||||||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
|
||||||
with:
|
|
||||||
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 unix checksum asset
|
|
||||||
if: runner.os != 'Windows'
|
|
||||||
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
|
|
||||||
with:
|
|
||||||
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
|
- 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
|
||||||
@ -263,7 +285,6 @@ 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
|
||||||
@ -352,6 +373,7 @@ jobs:
|
|||||||
- cloc
|
- cloc
|
||||||
- setup
|
- setup
|
||||||
- cli
|
- cli
|
||||||
|
- cli-windows
|
||||||
- snap
|
- snap
|
||||||
steps:
|
steps:
|
||||||
- name: Check if any job failed
|
- name: Check if any job failed
|
||||||
|
Loading…
Reference in New Issue
Block a user