1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-13 14:53:33 +00:00

Add CLI build (#2746)

Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>
This commit is contained in:
Micaiah Martin
2022-05-31 07:20:06 -06:00
committed by GitHub
parent ccfcb36f1c
commit 2f72286f66
6 changed files with 91 additions and 205 deletions

View File

@@ -1,22 +1,36 @@
--- ---
name: Build name: Build CLI
on: on:
push: pull_request:
branches-ignore: branches-ignore:
- 'l10n_master' - 'l10n_master'
paths-ignore: - 'gh-pages'
- '.github/workflows/**' paths:
- 'apps/cli/**'
- '.github/workflows/build-cli.yml'
push:
branches:
- 'master'
- 'rc'
- 'hotfix-rc/**'
paths:
- 'apps/cli/**'
- '.github/workflows/build-cli.yml'
workflow_dispatch: workflow_dispatch:
inputs: {} inputs: {}
defaults:
run:
working-directory: apps/cli
jobs: jobs:
cloc: cloc:
name: CLOC name: CLOC
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Set up cloc - name: Set up cloc
run: | run: |
@@ -34,7 +48,7 @@ jobs:
package_version: ${{ steps.retrieve-version.outputs.package_version }} package_version: ${{ steps.retrieve-version.outputs.package_version }}
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Get Package Version - name: Get Package Version
id: retrieve-version id: retrieve-version
@@ -42,55 +56,31 @@ jobs:
PKG_VERSION=$(jq -r .version package.json) PKG_VERSION=$(jq -r .version package.json)
echo "::set-output name=package_version::$PKG_VERSION" echo "::set-output name=package_version::$PKG_VERSION"
lint:
name: Lint
runs-on: ubuntu-20.04
steps:
- name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
- name: Cache npm
id: npm-cache
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed
with:
path: '~/.npm'
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Setup sub-module
run: npm run sub:init
- name: Install
run: npm ci
- name: Run linter
run: npm run lint
cli: cli:
name: Build CLI name: Build CLI
runs-on: windows-2019 runs-on: windows-2019
needs: needs:
- setup - setup
- lint
env: env:
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
_WIN_PKG_FETCH_VERSION: 16.14.2 _WIN_PKG_FETCH_VERSION: 16.15.0
_WIN_PKG_VERSION: 3.3 _WIN_PKG_VERSION: 3.4
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Setup Windows builder - name: Setup Windows builder
run: | run: |
choco install checksum --no-progress choco install checksum --no-progress
choco install reshack --no-progress choco install reshack --no-progress
choco install nasm --no-progress
- name: Set up Node - name: Set up Node
uses: actions/setup-node@9ced9a43a244f3ac94f13bfd896db8c8f30da67a # v3.0.0 uses: actions/setup-node@17f8bd926464a1afa4c6a11669539e9c1ba77048 # v3.2.0
with: with:
cache: 'npm' cache: 'npm'
cache-dependency-path: '**/package-lock.json' cache-dependency-path: 'apps/cli/**/package-lock.json'
node-version: '16' node-version: '16'
- name: Get pkg-fetch - name: Get pkg-fetch
@@ -98,7 +88,6 @@ jobs:
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"
New-Item -ItemType directory -Path .\.pkg-cache New-Item -ItemType directory -Path .\.pkg-cache
New-Item -ItemType directory -Path .\.pkg-cache\v$env:_WIN_PKG_VERSION New-Item -ItemType directory -Path .\.pkg-cache\v$env:_WIN_PKG_VERSION
Invoke-RestMethod -Uri $fetchedUrl ` Invoke-RestMethod -Uri $fetchedUrl `
@@ -108,9 +97,7 @@ jobs:
shell: pwsh shell: pwsh
run: | run: |
$major,$minor,$patch = $env:_PACKAGE_VERSION.split('.') $major,$minor,$patch = $env:_PACKAGE_VERSION.split('.')
$versionInfo = @" $versionInfo = @"
1 VERSIONINFO 1 VERSIONINFO
FILEVERSION $major,$minor,$patch,0 FILEVERSION $major,$minor,$patch,0
PRODUCTVERSION $major,$minor,$patch,0 PRODUCTVERSION $major,$minor,$patch,0
@@ -131,25 +118,21 @@ jobs:
VALUE "LegalCopyright", "Copyright Bitwarden Inc." VALUE "LegalCopyright", "Copyright Bitwarden Inc."
} }
} }
BLOCK "VarFileInfo" BLOCK "VarFileInfo"
{ {
VALUE "Translation", 0x0409 0x04B0 VALUE "Translation", 0x0409 0x04B0
} }
} }
"@ "@
$versionInfo | Out-File ./version-info.rc $versionInfo | Out-File ./version-info.rc
# https://github.com/vercel/pkg-fetch/issues/188 # https://github.com/vercel/pkg-fetch/issues/188
- name: Resource Hacker - name: Resource Hacker
shell: cmd shell: cmd
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
set WIN_PKG_BUILT=C:\Users\runneradmin\.pkg-cache\v%_WIN_PKG_VERSION%\built-v%_WIN_PKG_FETCH_VERSION%-win-x64 set WIN_PKG_BUILT=C:\Users\runneradmin\.pkg-cache\v%_WIN_PKG_VERSION%\built-v%_WIN_PKG_FETCH_VERSION%-win-x64
copy %WIN_PKG% %WIN_PKG_BUILT% copy %WIN_PKG% %WIN_PKG_BUILT%
ResourceHacker -open %WIN_PKG_BUILT% -save %WIN_PKG_BUILT% -action delete -mask ICONGROUP,1, ResourceHacker -open %WIN_PKG_BUILT% -save %WIN_PKG_BUILT% -action delete -mask ICONGROUP,1,
ResourceHacker -open version-info.rc -save version-info.res -action compile ResourceHacker -open version-info.rc -save version-info.res -action compile
@@ -165,15 +148,14 @@ jobs:
run: npm run test run: npm run test
- name: Build & Package - name: Build & Package
run: npm run dist run: npm run dist --quiet
- name: Package Chocolatey - name: Package Chocolatey
shell: pwsh shell: pwsh
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 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
@@ -188,7 +170,6 @@ jobs:
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"
$testVersion = Invoke-Expression '& ./test/windows/bw.exe -v' $testVersion = Invoke-Expression '& ./test/windows/bw.exe -v'
echo "version: $env:_PACKAGE_VERSION" echo "version: $env:_PACKAGE_VERSION"
echo "testVersion: $testVersion" echo "testVersion: $testVersion"
if($testVersion -ne $env:_PACKAGE_VERSION) { if($testVersion -ne $env:_PACKAGE_VERSION) {
@@ -205,59 +186,59 @@ jobs:
-t sha256 | Out-File -Encoding ASCII ./dist/bw-linux-sha256-${env:_PACKAGE_VERSION}.txt -t sha256 | Out-File -Encoding ASCII ./dist/bw-linux-sha256-${env:_PACKAGE_VERSION}.txt
- name: Upload windows zip asset - name: Upload windows zip asset
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with: with:
name: bw-windows-${{ env._PACKAGE_VERSION }}.zip name: bw-windows-${{ env._PACKAGE_VERSION }}.zip
path: ./dist/bw-windows-${{ env._PACKAGE_VERSION }}.zip path: apps/cli/dist/bw-windows-${{ env._PACKAGE_VERSION }}.zip
if-no-files-found: error if-no-files-found: error
- name: Upload windows checksum asset - name: Upload windows checksum asset
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 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: ./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 macos zip asset
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with: with:
name: bw-macos-${{ env._PACKAGE_VERSION }}.zip name: bw-macos-${{ env._PACKAGE_VERSION }}.zip
path: ./dist/bw-macos-${{ env._PACKAGE_VERSION }}.zip path: apps/cli/dist/bw-macos-${{ env._PACKAGE_VERSION }}.zip
if-no-files-found: error if-no-files-found: error
- name: Upload macos checksum asset - name: Upload macos checksum asset
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with: with:
name: bw-macos-sha256-${{ env._PACKAGE_VERSION }}.txt name: bw-macos-sha256-${{ env._PACKAGE_VERSION }}.txt
path: ./dist/bw-macos-sha256-${{ env._PACKAGE_VERSION }}.txt path: apps/cli/dist/bw-macos-sha256-${{ env._PACKAGE_VERSION }}.txt
if-no-files-found: error if-no-files-found: error
- name: Upload linux zip asset - name: Upload linux zip asset
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with: with:
name: bw-linux-${{ env._PACKAGE_VERSION }}.zip name: bw-linux-${{ env._PACKAGE_VERSION }}.zip
path: ./dist/bw-linux-${{ env._PACKAGE_VERSION }}.zip path: apps/cli/dist/bw-linux-${{ env._PACKAGE_VERSION }}.zip
if-no-files-found: error if-no-files-found: error
- name: Upload linux checksum asset - name: Upload linux checksum asset
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with: with:
name: bw-linux-sha256-${{ env._PACKAGE_VERSION }}.txt name: bw-linux-sha256-${{ env._PACKAGE_VERSION }}.txt
path: ./dist/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
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with: with:
name: bitwarden-cli.${{ env._PACKAGE_VERSION }}.nupkg name: bitwarden-cli.${{ env._PACKAGE_VERSION }}.nupkg
path: ./dist/chocolatey/bitwarden-cli.${{ env._PACKAGE_VERSION }}.nupkg path: apps/cli/dist/chocolatey/bitwarden-cli.${{ env._PACKAGE_VERSION }}.nupkg
if-no-files-found: error if-no-files-found: error
- name: Upload NPM Build Directory asset - name: Upload NPM Build Directory asset
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 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
path: ./build path: apps/cli/build
if-no-files-found: error if-no-files-found: error
snap: snap:
@@ -268,7 +249,7 @@ jobs:
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }} _PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Print environment - name: Print environment
run: | run: |
@@ -281,20 +262,19 @@ jobs:
uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741
with: with:
name: bw-linux-${{ env._PACKAGE_VERSION }}.zip name: bw-linux-${{ env._PACKAGE_VERSION }}.zip
path: ./dist/snap path: apps/cli/dist/snap
- name: Setup Snap Package - name: Setup Snap Package
run: | run: |
cp -r stores/snap/* -t dist/snap cp -r stores/snap/* -t dist/snap
sed -i s/__version__/${{ env._PACKAGE_VERSION }}/g dist/snap/snapcraft.yaml sed -i s/__version__/${{ env._PACKAGE_VERSION }}/g dist/snap/snapcraft.yaml
cd dist/snap cd dist/snap
ls -alth ls -alth
- name: Build snap - name: Build snap
uses: snapcore/action-build@a400bf1c2d0f23074aaacf08a144813c3c20b35d # v1.0.9 uses: snapcore/action-build@ea14cdeb353272f75977040488ca191880509a8c # v1.1.0
with: with:
path: dist/snap path: apps/cli/dist/snap
- name: Create checksum - name: Create checksum
run: | run: |
@@ -321,17 +301,17 @@ jobs:
run: sudo snap remove bw run: sudo snap remove bw
- name: Upload snap asset - name: Upload snap asset
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with: with:
name: bw_${{ env._PACKAGE_VERSION }}_amd64.snap name: bw_${{ env._PACKAGE_VERSION }}_amd64.snap
path: ./dist/snap/bw_${{ env._PACKAGE_VERSION }}_amd64.snap path: apps/cli/dist/snap/bw_${{ env._PACKAGE_VERSION }}_amd64.snap
if-no-files-found: error if-no-files-found: error
- name: Upload snap checksum asset - name: Upload snap checksum asset
uses: actions/upload-artifact@6673cd052c4cd6fcf4b4e6e60ea986c889389535 uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
with: with:
name: bw-snap-sha256-${{ env._PACKAGE_VERSION }}.txt name: bw-snap-sha256-${{ env._PACKAGE_VERSION }}.txt
path: ./dist/snap/bw-snap-sha256-${{ env._PACKAGE_VERSION }}.txt path: apps/cli/dist/snap/bw-snap-sha256-${{ env._PACKAGE_VERSION }}.txt
if-no-files-found: error if-no-files-found: error
@@ -342,7 +322,6 @@ jobs:
needs: needs:
- cloc - cloc
- setup - setup
- lint
- cli - cli
- snap - snap
steps: steps:
@@ -351,7 +330,6 @@ jobs:
env: env:
CLOC_STATUS: ${{ needs.cloc.result }} CLOC_STATUS: ${{ needs.cloc.result }}
SETUP_STATUS: ${{ needs.setup.result }} SETUP_STATUS: ${{ needs.setup.result }}
LINT_STATUS: ${{ needs.lint.result }}
CLI_STATUS: ${{ needs.cli.result }} CLI_STATUS: ${{ needs.cli.result }}
SNAP_STATUS: ${{ needs.snap.result }} SNAP_STATUS: ${{ needs.snap.result }}
run: | run: |
@@ -359,15 +337,14 @@ jobs:
exit 1 exit 1
elif [ "$SETUP_STATUS" = "failure" ]; then elif [ "$SETUP_STATUS" = "failure" ]; then
exit 1 exit 1
elif [ "$LINT_STATUS" = "failure" ]; then
exit 1
elif [ "$CLI_STATUS" = "failure" ]; then elif [ "$CLI_STATUS" = "failure" ]; then
exit 1 exit 1
elif [ "$SNAP_STATUS" = "failure" ]; then elif [ "$SNAP_STATUS" = "failure" ]; then
exit 1 exit 1
fi fi
- name: Login to Azure - Prod Subscription - name: Login to Azure - Prod Subscription
uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf uses: Azure/login@ec3c14589bd3e9312b3cc8c41e6860e258df9010 # v1.1
if: failure() if: failure()
with: with:
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}

View File

@@ -136,7 +136,7 @@ jobs:
dist-edge-${{ needs.setup.outputs.release-version }}.zip' dist-edge-${{ needs.setup.outputs.release-version }}.zip'
commit: ${{ github.sha }} commit: ${{ github.sha }}
tag: "browser-v${{ needs.setup.outputs.release-version }}" tag: "browser-v${{ needs.setup.outputs.release-version }}"
name: "Version ${{ needs.setup.outputs.release-version }}" name: "Browser v${{ needs.setup.outputs.release-version }}"
body: "<insert release notes here>" body: "<insert release notes here>"
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
draft: true draft: true

View File

@@ -1,5 +1,5 @@
--- ---
name: Release name: Release CLI
on: on:
workflow_dispatch: workflow_dispatch:
@@ -14,6 +14,10 @@ on:
- Redeploy - Redeploy
- Dry Run - Dry Run
defaults:
run:
working-directory: apps/cli
jobs: jobs:
setup: setup:
name: Setup name: Setup
@@ -25,15 +29,15 @@ jobs:
- name: Branch check - name: Branch check
if: ${{ github.event.inputs.release_type != 'Dry Run' }} if: ${{ github.event.inputs.release_type != 'Dry Run' }}
run: | run: |
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ $GITHUB_REF != refs/heads/hotfix-rc/* ]]; then
echo "===================================" echo "==================================="
echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches" echo "[!] Can only release from the 'rc' or 'hotfix-rc/*' branches"
echo "===================================" echo "==================================="
exit 1 exit 1
fi fi
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # 2.4.0 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Retrieve CLI release version - name: Retrieve CLI release version
id: retrieve-version id: retrieve-version
@@ -46,7 +50,9 @@ jobs:
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
latest_ver=$(hub release -L 1 -f '%T') latest_ver=$(
curl -sL https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq -r 'first(.[] | select(.tag_name | startswith("cli"))).tag_name'
)
latest_ver=${latest_ver:1} latest_ver=${latest_ver:1}
echo "Latest version: $latest_ver" echo "Latest version: $latest_ver"
ver=${{ steps.retrieve-version.outputs.package_version }} ver=${{ steps.retrieve-version.outputs.package_version }}
@@ -66,28 +72,28 @@ jobs:
- name: Download all artifacts - name: Download all artifacts
uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8 uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8
with: with:
workflow: build.yml workflow: build-cli.yml
path: apps/cli
workflow_conclusion: success workflow_conclusion: success
branch: ${{ steps.branch.outputs.branch-name }} branch: ${{ steps.branch.outputs.branch-name }}
- name: Create release - name: Create release
if: ${{ github.event.inputs.release_type != 'Dry Run' }} uses: ncipollo/release-action@58ae73b360456532aafd58ee170c045abbeaee37 # v1.10.0
uses: ncipollo/release-action@40bb172bd05f266cf9ba4ff965cb61e9ee5f6d01 # v1.9.0
env: env:
PKG_VERSION: ${{ steps.retrieve-version.outputs.package_version }} PKG_VERSION: ${{ steps.retrieve-version.outputs.package_version }}
with: with:
artifacts: "bw-windows-${{ env.PKG_VERSION }}.zip, artifacts: "apps/cli/bw-windows-${{ env.PKG_VERSION }}.zip,
bw-windows-sha256-${{ env.PKG_VERSION }}.txt, apps/cli/bw-windows-sha256-${{ env.PKG_VERSION }}.txt,
bw-macos-${{ env.PKG_VERSION }}.zip, apps/cli/bw-macos-${{ env.PKG_VERSION }}.zip,
bw-macos-sha256-${{ env.PKG_VERSION }}.txt, apps/cli/bw-macos-sha256-${{ env.PKG_VERSION }}.txt,
bw-linux-${{ env.PKG_VERSION }}.zip, apps/cli/bw-linux-${{ env.PKG_VERSION }}.zip,
bw-linux-sha256-${{ env.PKG_VERSION }}.txt, apps/cli/bw-linux-sha256-${{ env.PKG_VERSION }}.txt,
bitwarden-cli.${{ env.PKG_VERSION }}.nupkg, apps/cli/bitwarden-cli.${{ env.PKG_VERSION }}.nupkg,
bw_${{ env.PKG_VERSION }}_amd64.snap, apps/cli/bw_${{ env.PKG_VERSION }}_amd64.snap,
bw-snap-sha256-${{ env.PKG_VERSION }}.txt" apps/cli/bw-snap-sha256-${{ env.PKG_VERSION }}.txt"
commit: ${{ github.sha }} commit: ${{ github.sha }}
tag: v${{ env.PKG_VERSION }} tag: cli-v${{ env.PKG_VERSION }}
name: Version ${{ env.PKG_VERSION }} name: CLI v${{ env.PKG_VERSION }}
body: "<insert release notes here>" body: "<insert release notes here>"
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
draft: true draft: true
@@ -101,10 +107,10 @@ jobs:
_PKG_VERSION: ${{ needs.setup.outputs.package_version }} _PKG_VERSION: ${{ needs.setup.outputs.package_version }}
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Login to Azure - name: Login to Azure
uses: Azure/login@1f63701bf3e6892515f1b7ce2d2bf1708b46beaf uses: Azure/login@ec3c14589bd3e9312b3cc8c41e6860e258df9010 # v1.1
with: with:
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }} creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
@@ -123,7 +129,8 @@ jobs:
- name: Download artifacts - name: Download artifacts
uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8 uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8
with: with:
workflow: build.yml workflow: build-cli.yml
path: apps/cli
workflow_conclusion: success workflow_conclusion: success
branch: ${{ needs.setup.outputs.branch-name }} branch: ${{ needs.setup.outputs.branch-name }}
artifacts: bw_${{ env._PKG_VERSION }}_amd64.snap artifacts: bw_${{ env._PKG_VERSION }}_amd64.snap
@@ -143,7 +150,7 @@ jobs:
_PKG_VERSION: ${{ needs.setup.outputs.package_version }} _PKG_VERSION: ${{ needs.setup.outputs.package_version }}
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Setup Chocolatey - name: Setup Chocolatey
run: choco apikey --key $env:CHOCO_API_KEY --source https://push.chocolatey.org/ run: choco apikey --key $env:CHOCO_API_KEY --source https://push.chocolatey.org/
@@ -157,11 +164,11 @@ jobs:
- name: Download artifacts - name: Download artifacts
uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8 uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8
with: with:
workflow: build.yml workflow: build-cli.yml
path: apps/cli
workflow_conclusion: success workflow_conclusion: success
branch: ${{ needs.setup.outputs.branch-name }} branch: ${{ needs.setup.outputs.branch-name }}
artifacts: bitwarden-cli.${{ env._PKG_VERSION }}.nupkg artifacts: bitwarden-cli.${{ env._PKG_VERSION }}.nupkg
path: ./dist
- name: Push to Chocolatey - name: Push to Chocolatey
if: ${{ github.event.inputs.release_type != 'Dry Run' }} if: ${{ github.event.inputs.release_type != 'Dry Run' }}
@@ -179,16 +186,16 @@ jobs:
_PKG_VERSION: ${{ needs.setup.outputs.package_version }} _PKG_VERSION: ${{ needs.setup.outputs.package_version }}
steps: steps:
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0 uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: Download artifacts - name: Download artifacts
uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8 uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8
with: with:
workflow: build.yml workflow: build-cli.yml
path: apps/cli
workflow_conclusion: success workflow_conclusion: success
branch: ${{ needs.setup.outputs.branch-name }} branch: ${{ needs.setup.outputs.branch-name }}
artifacts: bitwarden-cli-${{ env._PKG_VERSION }}-npm-build.zip artifacts: bitwarden-cli-${{ env._PKG_VERSION }}-npm-build.zip
path: build
- name: Setup NPM - name: Setup NPM
run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc run: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc

View File

@@ -1,16 +0,0 @@
---
name: Enforce PR labels
on:
pull_request:
types: [labeled, unlabeled, opened, edited, synchronize]
jobs:
enforce-label:
name: EnforceLabel
runs-on: ubuntu-20.04
steps:
- name: Enforce Label
uses: yogevbd/enforce-label-action@8d1e1709b1011e6d90400a0e6cf7c0b77aa5efeb
with:
BANNED_LABELS: "hold"
BANNED_LABELS_DESCRIPTION: "PRs on hold cannot be merged"

View File

@@ -1,71 +0,0 @@
---
name: Version Bump
on:
workflow_dispatch:
inputs:
version_number:
description: "New Version"
required: true
jobs:
bump_version:
name: "Create version_bump_${{ github.event.inputs.version_number }} branch"
runs-on: ubuntu-20.04
steps:
- name: Checkout Branch
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
- name: Create Version Branch
run: |
git switch -c version_bump_${{ github.event.inputs.version_number }}
git push -u origin version_bump_${{ github.event.inputs.version_number }}
- name: Checkout Version Branch
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
with:
ref: version_bump_${{ github.event.inputs.version_number }}
- name: Bump Version - Package
uses: bitwarden/gh-actions/version-bump@03ad9a873c39cdc95dd8d77dbbda67f84db43945
with:
version: ${{ github.event.inputs.version_number }}
file_path: "./package.json"
- name: Bump Version - Package-lock
uses: bitwarden/gh-actions/version-bump@03ad9a873c39cdc95dd8d77dbbda67f84db43945
with:
version: ${{ github.event.inputs.version_number }}
file_path: "./package-lock.json"
- name: Commit files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git commit -m "Bumped version to ${{ github.event.inputs.version_number }}" -a
- name: Push changes
run: git push -u origin version_bump_${{ github.event.inputs.version_number }}
- name: Create Version PR
env:
PR_BRANCH: "version_bump_${{ github.event.inputs.version_number }}"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
BASE_BRANCH: master
TITLE: "Bump version to ${{ github.event.inputs.version_number }}"
run: |
gh pr create --title "$TITLE" \
--base "$BASE" \
--head "$PR_BRANCH" \
--label "version update" \
--label "automated pr" \
--body "
## Type of change
- [ ] Bug fix
- [ ] New feature development
- [ ] Tech debt (refactoring, code cleanup, dependency upgrades, etc)
- [ ] Build/deploy pipeline (DevOps)
- [X] Other
## Objective
Automated version bump to ${{ github.event.inputs.version_number }}"

View File

@@ -1,11 +0,0 @@
---
name: Workflow Linter
on:
pull_request:
paths:
- .github/workflows/**
jobs:
call-workflow:
uses: bitwarden/gh-actions/.github/workflows/workflow-linter.yml@master