Account for commercial licensed CLI code in pipelines (#9293)
* Add `:oss` prefix to preexisting npm commands * Build `bit` and `oss` versions in `build-cli` workflow * Update release job to publish new artifacts * Rename build job tasks for clarity
This commit is contained in:
parent
51af102f7c
commit
954d427539
|
@ -59,11 +59,20 @@ jobs:
|
|||
|
||||
|
||||
cli:
|
||||
name: Build CLI ${{ matrix.os }}
|
||||
name: "${{ matrix.os.base }} - ${{ matrix.license_type.readable }}"
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-22.04, macos-11]
|
||||
runs-on: ${{ matrix.os }}
|
||||
os:
|
||||
[
|
||||
{ base: "linux", distro: "ubuntu-22.04" },
|
||||
{ base: "mac", distro: "macos-11" }
|
||||
]
|
||||
license_type:
|
||||
[
|
||||
{ prefix: "oss", readable: "open source license" },
|
||||
{ prefix: "bit", readable: "commercial license"}
|
||||
]
|
||||
runs-on: ${{ matrix.os.distro }}
|
||||
needs:
|
||||
- setup
|
||||
env:
|
||||
|
@ -93,16 +102,16 @@ jobs:
|
|||
working-directory: ./
|
||||
|
||||
- name: Build & Package Unix
|
||||
run: npm run dist:${{ env.SHORT_RUNNER_OS }} --quiet
|
||||
run: npm run dist:${{ matrix.license_type.prefix }}:${{ 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
|
||||
cd ./dist/${{ matrix.license_type.prefix }}/${{ env.LOWER_RUNNER_OS }}
|
||||
zip ../../bw-${{ matrix.license_type.prefix }}-${{ 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"
|
||||
unzip "./dist/bw-${{ matrix.license_type.prefix }}-${{ env.LOWER_RUNNER_OS }}-${{ env._PACKAGE_VERSION }}.zip" -d "./test"
|
||||
testVersion=$(./test/bw -v)
|
||||
echo "version: $_PACKAGE_VERSION"
|
||||
echo "testVersion: $testVersion"
|
||||
|
@ -114,25 +123,32 @@ jobs:
|
|||
- name: Create checksums Unix
|
||||
run: |
|
||||
cd ./dist
|
||||
shasum -a 256 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
|
||||
shasum -a 256 bw-${{ matrix.license_type.prefix }}-${{ env.LOWER_RUNNER_OS }}-${{ env._PACKAGE_VERSION }}.zip \
|
||||
| awk '{split($0, a); print a[1]}' > bw-${{ matrix.license_type.prefix }}-${{ env.LOWER_RUNNER_OS }}-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||
|
||||
- name: Upload unix zip asset
|
||||
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
|
||||
with:
|
||||
name: bw-${{ env.LOWER_RUNNER_OS }}-${{ env._PACKAGE_VERSION }}.zip
|
||||
path: apps/cli/dist/bw-${{ env.LOWER_RUNNER_OS }}-${{ env._PACKAGE_VERSION }}.zip
|
||||
name: bw-${{ matrix.license_type.prefix }}-${{ env.LOWER_RUNNER_OS }}-${{ env._PACKAGE_VERSION }}.zip
|
||||
path: apps/cli/dist/bw-${{ matrix.license_type.prefix }}-${{ env.LOWER_RUNNER_OS }}-${{ env._PACKAGE_VERSION }}.zip
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload unix checksum asset
|
||||
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
|
||||
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
|
||||
name: bw-${{ matrix.license_type.prefix }}-${{ env.LOWER_RUNNER_OS }}-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||
path: apps/cli/dist/bw-${{ matrix.license_type.prefix }}-${{ env.LOWER_RUNNER_OS }}-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||
if-no-files-found: error
|
||||
|
||||
cli-windows:
|
||||
name: Build CLI Windows
|
||||
name: "windows - ${{ matrix.license_type.readable }}"
|
||||
strategy:
|
||||
matrix:
|
||||
license_type:
|
||||
[
|
||||
{ prefix: "oss", readable: "open source license" },
|
||||
{ prefix: "bit", readable: "commercial license"}
|
||||
]
|
||||
runs-on: windows-2022
|
||||
needs:
|
||||
- setup
|
||||
|
@ -218,25 +234,26 @@ jobs:
|
|||
working-directory: ./
|
||||
|
||||
- name: Build & Package Windows
|
||||
run: npm run dist:win --quiet
|
||||
run: npm run dist:${{ matrix.license_type.prefix }}:win --quiet
|
||||
|
||||
- name: Package Chocolatey
|
||||
shell: pwsh
|
||||
if: ${{ matrix.license_type.prefix }} == 'oss'
|
||||
run: |
|
||||
Copy-Item -Path stores/chocolatey -Destination dist/chocolatey -Recurse
|
||||
Copy-Item dist/windows/bw.exe -Destination dist/chocolatey/tools
|
||||
Copy-Item dist/${{ matrix.license_type.prefix }}/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 Windows
|
||||
shell: cmd
|
||||
run: 7z a ./dist/bw-windows-%_PACKAGE_VERSION%.zip ./dist/windows/bw.exe
|
||||
run: 7z a ./dist/bw-${{ matrix.license_type.prefix }}-windows-%_PACKAGE_VERSION%.zip ./dist/${{ matrix.license_type.prefix }}/windows/bw.exe
|
||||
|
||||
- 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'
|
||||
Expand-Archive -Path "./dist/bw-${{ matrix.license_type.prefix }}-windows-${env:_PACKAGE_VERSION}.zip" -DestinationPath "./test/${{ matrix.license_type.prefix }}/windows"
|
||||
$testVersion = Invoke-Expression '& ./test/${{ matrix.license_type.prefix }}/windows/bw.exe -v'
|
||||
echo "version: $env:_PACKAGE_VERSION"
|
||||
echo "testVersion: $testVersion"
|
||||
if($testVersion -ne $env:_PACKAGE_VERSION) {
|
||||
|
@ -245,24 +262,25 @@ jobs:
|
|||
|
||||
- name: Create checksums 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-${{ matrix.license_type.prefix }}-windows-${env:_PACKAGE_VERSION}.zip" `
|
||||
-t sha256 | Out-File -Encoding ASCII ./dist/bw-${{ matrix.license_type.prefix }}-windows-sha256-${env:_PACKAGE_VERSION}.txt
|
||||
|
||||
- name: Upload windows zip asset
|
||||
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
|
||||
with:
|
||||
name: bw-windows-${{ env._PACKAGE_VERSION }}.zip
|
||||
path: apps/cli/dist/bw-windows-${{ env._PACKAGE_VERSION }}.zip
|
||||
name: bw-${{ matrix.license_type.prefix }}-windows-${{ env._PACKAGE_VERSION }}.zip
|
||||
path: apps/cli/dist/bw-${{ matrix.license_type.prefix }}-windows-${{ env._PACKAGE_VERSION }}.zip
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload windows checksum asset
|
||||
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
|
||||
with:
|
||||
name: bw-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||
path: apps/cli/dist/bw-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||
name: bw-${{ matrix.license_type.prefix }}-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||
path: apps/cli/dist/bw-${{ matrix.license_type.prefix }}-windows-sha256-${{ env._PACKAGE_VERSION }}.txt
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Upload Chocolatey asset
|
||||
if: matrix.license_type.prefix == 'oss'
|
||||
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
|
||||
with:
|
||||
name: bitwarden-cli.${{ env._PACKAGE_VERSION }}.nupkg
|
||||
|
@ -270,6 +288,7 @@ jobs:
|
|||
if-no-files-found: error
|
||||
|
||||
- name: Upload NPM Build Directory asset
|
||||
if: matrix.license_type.prefix == 'oss'
|
||||
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
|
||||
with:
|
||||
name: bitwarden-cli-${{ env._PACKAGE_VERSION }}-npm-build.zip
|
||||
|
@ -299,9 +318,14 @@ jobs:
|
|||
- name: Get bw linux cli
|
||||
uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427 # v4.1.4
|
||||
with:
|
||||
name: bw-linux-${{ env._PACKAGE_VERSION }}.zip
|
||||
name: bw-oss-linux-${{ env._PACKAGE_VERSION }}.zip
|
||||
path: apps/cli/dist/snap
|
||||
|
||||
- name: Rename snap artifact
|
||||
run: |
|
||||
cd dist/snap
|
||||
mv bw-oss-linux-${{ env._PACKAGE_VERSION }}.zip bw-linux-${{ env._PACKAGE_VERSION }}.zip
|
||||
|
||||
- name: Setup Snap Package
|
||||
run: |
|
||||
cp -r stores/snap/* -t dist/snap
|
||||
|
|
|
@ -100,12 +100,18 @@ jobs:
|
|||
env:
|
||||
PKG_VERSION: ${{ steps.version.outputs.version }}
|
||||
with:
|
||||
artifacts: "apps/cli/bw-windows-${{ env.PKG_VERSION }}.zip,
|
||||
apps/cli/bw-windows-sha256-${{ env.PKG_VERSION }}.txt,
|
||||
apps/cli/bw-macos-${{ env.PKG_VERSION }}.zip,
|
||||
apps/cli/bw-macos-sha256-${{ env.PKG_VERSION }}.txt,
|
||||
apps/cli/bw-linux-${{ env.PKG_VERSION }}.zip,
|
||||
apps/cli/bw-linux-sha256-${{ env.PKG_VERSION }}.txt,
|
||||
artifacts: "apps/cli/bw-oss-windows-${{ env.PKG_VERSION }}.zip,
|
||||
apps/cli/bw-oss-windows-sha256-${{ env.PKG_VERSION }}.txt,
|
||||
apps/cli/bw-bit-windows-${{ env.PKG_VERSION }}.zip,
|
||||
apps/cli/bw-bit-windows-sha256-${{ env.PKG_VERSION }}.txt,
|
||||
apps/cli/bw-oss-macos-${{ env.PKG_VERSION }}.zip,
|
||||
apps/cli/bw-oss-macos-sha256-${{ env.PKG_VERSION }}.txt,
|
||||
apps/cli/bw-bit-macos-${{ env.PKG_VERSION }}.zip,
|
||||
apps/cli/bw-bit-macos-sha256-${{ env.PKG_VERSION }}.txt,
|
||||
apps/cli/bw-oss-linux-${{ env.PKG_VERSION }}.zip,
|
||||
apps/cli/bw-oss-linux-sha256-${{ env.PKG_VERSION }}.txt,
|
||||
apps/cli/bw-bit-linux-${{ env.PKG_VERSION }}.zip,
|
||||
apps/cli/bw-bit-linux-sha256-${{ env.PKG_VERSION }}.txt,
|
||||
apps/cli/bitwarden-cli.${{ env.PKG_VERSION }}.nupkg,
|
||||
apps/cli/bw_${{ env.PKG_VERSION }}_amd64.snap,
|
||||
apps/cli/bw-snap-sha256-${{ env.PKG_VERSION }}.txt"
|
||||
|
|
|
@ -18,30 +18,27 @@
|
|||
"license": "GPL-3.0-only",
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"build": "webpack",
|
||||
"build:debug": "npm run build && node --inspect ./build/bw.js",
|
||||
"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:mac": "pkg . --targets macos-x64 --output ./dist/macos/bw",
|
||||
"package:lin": "pkg . --targets linux-x64 --output ./dist/linux/bw",
|
||||
"build:oss": "webpack",
|
||||
"build:oss:debug": "npm run build:oss && node --inspect ./build/bw.js",
|
||||
"build:oss:watch": "webpack --watch",
|
||||
"build:oss:prod": "cross-env NODE_ENV=production webpack",
|
||||
"build:oss:prod:watch": "cross-env NODE_ENV=production webpack --watch",
|
||||
"debug": "node --inspect ./build/bw.js",
|
||||
"dist": "npm run build:prod && npm run clean && npm run package",
|
||||
"dist:win": "npm run build:prod && npm run clean && npm run package:win",
|
||||
"dist:mac": "npm run build:prod && npm run clean && npm run package:mac",
|
||||
"dist:lin": "npm run build:prod && npm run clean && npm run package:lin",
|
||||
"publish:npm": "npm run build:prod && npm publish --access public",
|
||||
"publish:npm": "npm run build:oss:prod && npm publish --access public",
|
||||
"build:bit": "webpack -c ../../bitwarden_license/bit-cli/webpack.config.js",
|
||||
"build:bit:debug": "npm run build:bit && node --inspect ./build/bw.js",
|
||||
"build:bit:watch": "webpack --watch -c ../../bitwarden_license/bit-cli/webpack.config.js",
|
||||
"build:bit:prod": "cross-env NODE_ENV=production npm run build:bit",
|
||||
"build:bit:prod:watch": "cross-env NODE_ENV=production npm run build:bit:watch",
|
||||
"dist:bit": "npm run build:bit:prod && npm run clean && npm run package",
|
||||
"dist:oss:win": "npm run build:oss:prod && npm run clean && npm run package:oss:win",
|
||||
"dist:oss:mac": "npm run build:oss:prod && npm run clean && npm run package:oss:mac",
|
||||
"dist:oss:lin": "npm run build:oss:prod && npm run clean && npm run package:oss:lin",
|
||||
"dist:bit:win": "npm run build:bit:prod && npm run clean && npm run package:bit:win",
|
||||
"dist:bit:mac": "npm run build:bit:prod && npm run clean && npm run package:bit:mac",
|
||||
"dist:bit:lin": "npm run build:bit:prod && npm run clean && npm run package:bit:lin",
|
||||
"package:oss:win": "pkg . --targets win-x64 --output ./dist/oss/windows/bw.exe",
|
||||
"package:oss:mac": "pkg . --targets macos-x64 --output ./dist/oss/macos/bw",
|
||||
"package:oss:lin": "pkg . --targets linux-x64 --output ./dist/oss/linux/bw",
|
||||
"package:bit:win": "pkg . --targets win-x64 --output ./dist/bit/windows/bw.exe",
|
||||
"package:bit:mac": "pkg . --targets macos-x64 --output ./dist/bit/macos/bw",
|
||||
"package:bit:lin": "pkg . --targets linux-x64 --output ./dist/bit/linux/bw",
|
||||
|
|
Loading…
Reference in New Issue