mirror of https://github.com/bitwarden/cli.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
156 lines
4.7 KiB
156 lines
4.7 KiB
--- |
|
name: Deploy |
|
|
|
on: |
|
workflow_dispatch: |
|
inputs: |
|
release_tag_name_input: |
|
description: "Release Tag Name <X.X.X>" |
|
required: true |
|
release: |
|
types: |
|
- published |
|
|
|
|
|
jobs: |
|
setup: |
|
name: Setup |
|
runs-on: ubuntu-20.04 |
|
outputs: |
|
package_version: ${{ steps.create_tags.outputs.package_version }} |
|
tag_version: ${{ steps.create_tags.outputs.tag_version }} |
|
steps: |
|
- name: Checkout Repo |
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 |
|
with: |
|
ref: 'rc' |
|
|
|
- name: Create Deploy version vars |
|
id: create_tags |
|
run: | |
|
if [ "${{ github.event_name }}" != "release" ]; then |
|
case "${RELEASE_TAG_NAME_INPUT:0:1}" in |
|
v) |
|
echo "RELEASE_NAME=${RELEASE_TAG_NAME_INPUT:1}" >> $GITHUB_ENV |
|
echo "RELEASE_TAG_NAME=$RELEASE_TAG_NAME_INPUT" >> $GITHUB_ENV |
|
echo "::set-output name=package_version::${RELEASE_TAG_NAME_INPUT:1}" |
|
echo "::set-output name=tag_version::$RELEASE_TAG_NAME_INPUT" |
|
;; |
|
[0-9]) |
|
echo "RELEASE_NAME=$RELEASE_TAG_NAME_INPUT" >> $GITHUB_ENV |
|
echo "RELEASE_TAG_NAME=v$RELEASE_TAG_NAME_INPUT" >> $GITHUB_ENV |
|
echo "::set-output name=package_version::$RELEASE_TAG_NAME_INPUT" |
|
echo "::set-output name=tag_version::v$RELEASE_TAG_NAME_INPUT" |
|
;; |
|
*) |
|
exit 1 |
|
;; |
|
esac |
|
else |
|
TAG_VERSION=$(echo ${{ github.ref }} | cut -d "/" -f 3) |
|
PKG_VERSION=${TAG_VERSION:1} |
|
|
|
echo "::set-output name=package_version::$PKG_VERSION" |
|
echo "::set-output name=tag_version::$TAG_VERSION" |
|
fi |
|
env: |
|
RELEASE_TAG_NAME_INPUT: ${{ github.event.inputs.release_tag_name_input }} |
|
|
|
|
|
snap: |
|
name: Deploy Snap |
|
runs-on: ubuntu-20.04 |
|
needs: setup |
|
env: |
|
_PKG_VERSION: ${{ needs.setup.outputs.package_version }} |
|
_TAG_VERSION: ${{ needs.setup.outputs.tag_version }} |
|
steps: |
|
- name: Checkout repo |
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 |
|
|
|
- name: Install Snapcraft |
|
uses: samuelmeuli/action-snapcraft@10d7d0a84d9d86098b19f872257df314b0bd8e2d # v1.2.0 |
|
with: |
|
snapcraft_token: ${{ secrets.SNAP_TOKEN }} |
|
|
|
- name: Setup |
|
run: mkdir dist |
|
|
|
- name: Get snap release assets |
|
uses: Xotl/cool-github-releases@16c58a5863d6ba9944f63ca8bb78bb3249ce1d81 # v1.1.6 |
|
with: |
|
mode: download |
|
tag_name: ${{ env._TAG_VERSION }} |
|
assets: bw_${{ env._PKG_VERSION }}_amd64.snap|./dist/bw_${{ env._PKG_VERSION }}_amd64.snap |
|
github_token: ${{ secrets.GITHUB_TOKEN }} |
|
|
|
- name: Test |
|
run: ls -alht dist |
|
|
|
- name: Publish Snap & logout |
|
run: | |
|
snapcraft push ./dist/bw_${{ env._PKG_VERSION }}_amd64.snap --release stable |
|
snapcraft logout |
|
|
|
|
|
choco: |
|
name: Deploy Choco |
|
runs-on: windows-2019 |
|
needs: setup |
|
env: |
|
_PKG_VERSION: ${{ needs.setup.outputs.package_version }} |
|
_TAG_VERSION: ${{ needs.setup.outputs.tag_version }} |
|
steps: |
|
- name: Checkout repo |
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 |
|
with: |
|
ref: 'rc' |
|
|
|
- name: Setup Chocolatey |
|
run: choco apikey --key $env:CHOCO_API_KEY --source https://push.chocolatey.org/ |
|
env: |
|
CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }} |
|
|
|
- name: Make dist dir |
|
shell: pwsh |
|
run: New-Item -ItemType directory -Path ./dist |
|
|
|
- name: Get nupkg release asset |
|
uses: Xotl/cool-github-releases@16c58a5863d6ba9944f63ca8bb78bb3249ce1d81 # v1.1.6 |
|
with: |
|
mode: download |
|
tag_name: ${{ env._TAG_VERSION }} |
|
assets: bitwarden-cli.${{ env._PKG_VERSION }}.nupkg|./dist/bitwarden-cli.${{ env._PKG_VERSION }}.nupkg |
|
github_token: ${{ secrets.GITHUB_TOKEN }} |
|
|
|
- name: Push to Chocolatey |
|
shell: pwsh |
|
run: | |
|
cd dist |
|
choco push |
|
|
|
|
|
npm: |
|
name: Publish NPM |
|
runs-on: ubuntu-20.04 |
|
steps: |
|
- name: Checkout repo |
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4 |
|
with: |
|
ref: 'rc' |
|
|
|
- name: Setup NPM |
|
shell: pwsh |
|
run: | |
|
"//registry.npmjs.org/:_authToken=${env:NPM_TOKEN}" | Out-File ".npmrc" -Encoding UTF8 |
|
env: |
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
|
|
|
- name: Setup sub-module |
|
run: npm run sub:init |
|
|
|
- name: NPM install |
|
run: npm install |
|
|
|
- name: Publish NPM |
|
run: npm run publish:npm
|
|
|