2021-09-02 22:04:02 +02:00
|
|
|
---
|
2021-01-27 20:15:29 +01:00
|
|
|
name: Release
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
setup:
|
2021-09-02 22:04:02 +02:00
|
|
|
name: Setup
|
2021-09-21 16:23:06 +02:00
|
|
|
runs-on: ubuntu-20.04
|
2021-01-27 20:15:29 +01:00
|
|
|
outputs:
|
2021-10-05 22:20:18 +02:00
|
|
|
package_version: ${{ steps.retrieve-version.outputs.package_version }}
|
2021-01-27 20:15:29 +01:00
|
|
|
steps:
|
2021-06-01 22:50:53 +02:00
|
|
|
- name: Branch check
|
|
|
|
run: |
|
2021-10-22 17:41:23 +02:00
|
|
|
if [[ "$GITHUB_REF" != "refs/heads/release" ]]; then
|
2021-06-01 22:50:53 +02:00
|
|
|
echo "==================================="
|
2021-10-22 17:41:23 +02:00
|
|
|
echo "[!] Can only release from the 'release' branch"
|
2021-06-01 22:50:53 +02:00
|
|
|
echo "==================================="
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-01-27 20:15:29 +01:00
|
|
|
- name: Checkout repo
|
2021-06-02 20:20:22 +02:00
|
|
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # 2.3.4
|
2021-10-05 22:20:18 +02:00
|
|
|
with:
|
2021-10-22 17:41:23 +02:00
|
|
|
ref: release
|
2021-01-27 20:15:29 +01:00
|
|
|
|
2021-10-05 22:20:18 +02:00
|
|
|
- name: Retrieve CLI release version
|
|
|
|
id: retrieve-version
|
2021-01-27 20:15:29 +01:00
|
|
|
run: |
|
2021-10-05 22:20:18 +02:00
|
|
|
PKG_VERSION=$(jq -r .version package.json)
|
|
|
|
echo "::set-output name=package_version::$PKG_VERSION"
|
2021-01-27 20:15:29 +01:00
|
|
|
|
2021-10-05 22:20:18 +02:00
|
|
|
- name: Check to make sure CLI release version has been bumped
|
2021-01-27 20:15:29 +01:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-10-05 22:20:18 +02:00
|
|
|
run: |
|
|
|
|
latest_ver=$(hub release -L 1 -f '%T')
|
|
|
|
latest_ver=${latest_ver:1}
|
|
|
|
echo "Latest version: $latest_ver"
|
|
|
|
ver=${{ steps.retrieve-version.outputs.package_version }}
|
|
|
|
echo "Version: $ver"
|
|
|
|
if [ "$latest_ver" = "$ver" ]; then
|
|
|
|
echo "Version has not been bumped!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
shell: bash
|
|
|
|
|
|
|
|
- name: Download all artifacts
|
|
|
|
uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783
|
|
|
|
with:
|
|
|
|
workflow: build.yml
|
|
|
|
workflow_conclusion: success
|
2021-10-22 17:41:23 +02:00
|
|
|
branch: release
|
2021-10-05 22:20:18 +02:00
|
|
|
|
|
|
|
- name: Create release
|
|
|
|
uses: ncipollo/release-action@95215a3cb6e6a1908b3c44e00b4fdb15548b1e09 # v2.8.5
|
|
|
|
env:
|
|
|
|
PKG_VERSION: ${{ steps.retrieve-version.outputs.package_version }}
|
2021-01-27 20:15:29 +01:00
|
|
|
with:
|
2021-10-05 22:20:18 +02:00
|
|
|
artifacts: "bw-windows-${{ env.PKG_VERSION }}.zip,
|
|
|
|
bw-windows-sha256-${{ env.PKG_VERSION }}.txt,
|
|
|
|
bw-macos-${{ env.PKG_VERSION }}.zip,
|
|
|
|
bw-macos-sha256-${{ env.PKG_VERSION }}.txt,
|
|
|
|
bw-linux-${{ env.PKG_VERSION }}.zip,
|
|
|
|
bw-linux-sha256-${{ env.PKG_VERSION }}.txt,
|
|
|
|
bitwarden-cli.${{ env.PKG_VERSION }}.nupkg,
|
|
|
|
bw_${{ env.PKG_VERSION }}_amd64.snap,
|
|
|
|
bw-snap-sha256-${{ env.PKG_VERSION }}.txt"
|
|
|
|
commit: ${{ github.sha }}
|
|
|
|
tag: v${{ env.PKG_VERSION }}
|
|
|
|
name: Version ${{ env.PKG_VERSION }}
|
|
|
|
body: "<insert release notes here>"
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
2021-01-27 20:15:29 +01:00
|
|
|
draft: true
|
|
|
|
|
|
|
|
|
2021-10-05 22:20:18 +02:00
|
|
|
snap:
|
|
|
|
name: Deploy Snap
|
|
|
|
runs-on: ubuntu-20.04
|
2021-01-27 20:15:29 +01:00
|
|
|
needs: setup
|
2021-07-14 20:41:05 +02:00
|
|
|
env:
|
2021-10-05 22:20:18 +02:00
|
|
|
_PKG_VERSION: ${{ needs.setup.outputs.package_version }}
|
2021-01-27 20:15:29 +01:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2021-10-05 22:20:18 +02:00
|
|
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
2021-01-27 20:15:29 +01:00
|
|
|
with:
|
2021-10-22 17:41:23 +02:00
|
|
|
ref: release
|
2021-01-27 20:15:29 +01:00
|
|
|
|
2021-10-05 22:20:18 +02:00
|
|
|
- name: Install Snapcraft
|
|
|
|
uses: samuelmeuli/action-snapcraft@10d7d0a84d9d86098b19f872257df314b0bd8e2d # v1.2.0
|
2021-01-28 17:42:01 +01:00
|
|
|
with:
|
2021-10-05 22:20:18 +02:00
|
|
|
snapcraft_token: ${{ secrets.SNAP_TOKEN }}
|
2021-01-28 17:42:01 +01:00
|
|
|
|
2021-10-05 22:20:18 +02:00
|
|
|
- name: Download artifacts
|
|
|
|
uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783
|
2021-01-27 20:15:29 +01:00
|
|
|
with:
|
2021-10-05 22:20:18 +02:00
|
|
|
workflow: build.yml
|
|
|
|
workflow_conclusion: success
|
2021-10-22 17:41:23 +02:00
|
|
|
branch: release
|
2021-10-05 22:20:18 +02:00
|
|
|
artifacts: bw_${{ env._PKG_VERSION }}_amd64.snap
|
2021-01-27 20:15:29 +01:00
|
|
|
|
2021-10-05 22:20:18 +02:00
|
|
|
- name: Publish Snap & logout
|
|
|
|
run: |
|
|
|
|
snapcraft push bw_${{ env._PKG_VERSION }}_amd64.snap --release stable
|
|
|
|
snapcraft logout
|
2021-01-27 20:15:29 +01:00
|
|
|
|
|
|
|
|
2021-10-05 22:20:18 +02:00
|
|
|
choco:
|
|
|
|
name: Deploy Choco
|
|
|
|
runs-on: windows-2019
|
|
|
|
needs: setup
|
|
|
|
env:
|
|
|
|
_PKG_VERSION: ${{ needs.setup.outputs.package_version }}
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
|
|
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
2021-01-27 20:15:29 +01:00
|
|
|
with:
|
2021-10-22 17:41:23 +02:00
|
|
|
ref: release
|
2021-01-27 20:15:29 +01:00
|
|
|
|
2021-10-05 22:20:18 +02:00
|
|
|
- name: Setup Chocolatey
|
|
|
|
run: choco apikey --key $env:CHOCO_API_KEY --source https://push.chocolatey.org/
|
2021-01-27 20:15:29 +01:00
|
|
|
env:
|
2021-10-05 22:20:18 +02:00
|
|
|
CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }}
|
2021-01-27 20:15:29 +01:00
|
|
|
|
2021-10-27 22:10:18 +02:00
|
|
|
- name: Make dist dir
|
|
|
|
shell: pwsh
|
|
|
|
run: New-Item -ItemType directory -Path ./dist
|
|
|
|
|
2021-10-05 22:20:18 +02:00
|
|
|
- name: Download artifacts
|
|
|
|
uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783
|
2021-01-27 20:15:29 +01:00
|
|
|
with:
|
2021-10-05 22:20:18 +02:00
|
|
|
workflow: build.yml
|
|
|
|
workflow_conclusion: success
|
2021-10-22 17:41:23 +02:00
|
|
|
branch: release
|
2021-10-05 22:20:18 +02:00
|
|
|
artifacts: bitwarden-cli.${{ env._PKG_VERSION }}.nupkg
|
2021-10-27 22:10:18 +02:00
|
|
|
path: ./dist
|
2021-10-05 22:20:18 +02:00
|
|
|
|
|
|
|
- name: Push to Chocolatey
|
|
|
|
shell: pwsh
|
2021-10-27 22:10:18 +02:00
|
|
|
run: |
|
|
|
|
cd dist
|
|
|
|
choco push
|
2021-01-27 20:15:29 +01:00
|
|
|
|
|
|
|
|
2021-10-05 22:20:18 +02:00
|
|
|
npm:
|
|
|
|
name: Publish NPM
|
2021-09-21 16:23:06 +02:00
|
|
|
runs-on: ubuntu-20.04
|
2021-10-05 22:20:18 +02:00
|
|
|
needs: setup
|
2021-10-27 22:10:18 +02:00
|
|
|
env:
|
|
|
|
_PKG_VERSION: ${{ needs.setup.outputs.package_version }}
|
2021-01-27 20:15:29 +01:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2021-10-05 22:20:18 +02:00
|
|
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
2021-01-28 17:42:01 +01:00
|
|
|
with:
|
2021-10-22 17:41:23 +02:00
|
|
|
ref: release
|
2021-01-28 17:42:01 +01:00
|
|
|
|
2021-10-05 22:20:18 +02:00
|
|
|
- name: Download artifacts
|
|
|
|
uses: bitwarden/gh-actions/download-artifacts@23433be15ed6fd046ce12b6889c5184a8d9c8783
|
2021-08-12 00:38:05 +02:00
|
|
|
with:
|
2021-10-05 22:20:18 +02:00
|
|
|
workflow: build.yml
|
|
|
|
workflow_conclusion: success
|
2021-10-22 17:41:23 +02:00
|
|
|
branch: release
|
2021-10-27 22:10:18 +02:00
|
|
|
artifacts: bitwarden-cli-${{ env._PKG_VERSION }}-npm-build.zip
|
2021-10-28 17:34:45 +02:00
|
|
|
path: build
|
2021-08-12 00:38:05 +02:00
|
|
|
|
2021-10-05 22:20:18 +02:00
|
|
|
- name: Setup NPM
|
2021-08-12 00:38:05 +02:00
|
|
|
run: |
|
2021-10-05 22:20:18 +02:00
|
|
|
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
|
2021-05-11 22:18:27 +02:00
|
|
|
env:
|
2021-10-05 22:20:18 +02:00
|
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
2021-01-27 20:15:29 +01:00
|
|
|
|
2021-10-05 22:20:18 +02:00
|
|
|
- name: Publish NPM
|
|
|
|
run: npm publish --access public
|