2021-09-02 22:04:02 +02:00
|
|
|
---
|
2021-01-27 20:15:29 +01:00
|
|
|
name: Deploy
|
|
|
|
|
2021-09-02 22:04:02 +02:00
|
|
|
on:
|
2021-01-27 20:15:29 +01:00
|
|
|
workflow_dispatch:
|
|
|
|
inputs:
|
2021-01-28 19:46:23 +01:00
|
|
|
release_tag_name_input:
|
|
|
|
description: "Release Tag Name <X.X.X>"
|
|
|
|
required: true
|
2021-01-28 19:59:07 +01:00
|
|
|
release:
|
|
|
|
types:
|
2021-01-28 21:22:36 +01:00
|
|
|
- published
|
2021-01-27 20:15:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
setup:
|
2021-09-02 22:04:02 +02:00
|
|
|
name: Setup
|
2021-01-27 20:15:29 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
2021-01-28 19:46:23 +01:00
|
|
|
package_version: ${{ steps.create_tags.outputs.package_version }}
|
|
|
|
tag_version: ${{ steps.create_tags.outputs.tag_version }}
|
2021-01-27 20:15:29 +01:00
|
|
|
steps:
|
|
|
|
- name: Checkout Repo
|
2021-09-02 22:04:02 +02:00
|
|
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
2021-03-15 15:28:59 +01:00
|
|
|
with:
|
|
|
|
ref: 'rc'
|
2021-01-27 20:15:29 +01:00
|
|
|
|
2021-01-28 19:59:07 +01:00
|
|
|
- name: Create Deploy version vars
|
2021-01-28 19:46:23 +01:00
|
|
|
id: create_tags
|
|
|
|
run: |
|
2021-02-03 19:42:11 +01:00
|
|
|
if [ "${{ github.event_name }}" != "release" ]; then
|
2021-01-28 19:59:07 +01:00
|
|
|
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
|
2021-01-28 19:46:23 +01:00
|
|
|
env:
|
|
|
|
RELEASE_TAG_NAME_INPUT: ${{ github.event.inputs.release_tag_name_input }}
|
|
|
|
|
2021-01-27 20:15:29 +01:00
|
|
|
|
|
|
|
snap:
|
2021-01-28 20:22:34 +01:00
|
|
|
name: Deploy Snap
|
2021-01-27 20:15:29 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: setup
|
2021-01-28 19:04:16 +01:00
|
|
|
env:
|
2021-09-02 22:04:02 +02:00
|
|
|
_PKG_VERSION: ${{ needs.setup.outputs.package_version }}
|
|
|
|
_TAG_VERSION: ${{ needs.setup.outputs.tag_version }}
|
2021-01-27 20:15:29 +01:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2021-09-02 22:04:02 +02:00
|
|
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
2021-01-27 20:15:29 +01:00
|
|
|
|
|
|
|
- name: Install Snapcraft
|
2021-09-02 22:04:02 +02:00
|
|
|
uses: samuelmeuli/action-snapcraft@10d7d0a84d9d86098b19f872257df314b0bd8e2d # v1.2.0
|
|
|
|
with:
|
2021-01-28 22:05:17 +01:00
|
|
|
snapcraft_token: ${{ secrets.SNAP_TOKEN }}
|
2021-01-27 20:15:29 +01:00
|
|
|
|
2021-09-02 22:04:02 +02:00
|
|
|
- name: Setup
|
2021-01-28 20:45:55 +01:00
|
|
|
run: mkdir dist
|
2021-01-27 20:15:29 +01:00
|
|
|
|
2021-02-03 19:12:18 +01:00
|
|
|
- name: Get snap release assets
|
2021-09-02 22:04:02 +02:00
|
|
|
uses: Xotl/cool-github-releases@16c58a5863d6ba9944f63ca8bb78bb3249ce1d81 # v1.1.6
|
2021-01-28 20:45:55 +01:00
|
|
|
with:
|
|
|
|
mode: download
|
2021-09-02 22:04:02 +02:00
|
|
|
tag_name: ${{ env._TAG_VERSION }}
|
|
|
|
assets: bw_${{ env._PKG_VERSION }}_amd64.snap|./dist/bw_${{ env._PKG_VERSION }}_amd64.snap
|
2021-01-28 20:45:55 +01:00
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
2021-01-27 20:15:29 +01:00
|
|
|
|
2021-09-02 22:04:02 +02:00
|
|
|
- name: Test
|
2021-01-27 20:15:29 +01:00
|
|
|
run: ls -alht dist
|
|
|
|
|
2021-01-28 22:05:17 +01:00
|
|
|
- name: Publish Snap & logout
|
|
|
|
run: |
|
2021-09-02 22:04:02 +02:00
|
|
|
snapcraft push ./dist/bw_${{ env._PKG_VERSION }}_amd64.snap --release stable
|
2021-01-28 22:05:17 +01:00
|
|
|
snapcraft logout
|
2021-01-27 20:15:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
choco:
|
2021-01-28 20:22:34 +01:00
|
|
|
name: Deploy Choco
|
2021-01-27 20:15:29 +01:00
|
|
|
runs-on: windows-latest
|
|
|
|
needs: setup
|
2021-01-28 19:04:16 +01:00
|
|
|
env:
|
2021-09-02 22:04:02 +02:00
|
|
|
_PKG_VERSION: ${{ needs.setup.outputs.package_version }}
|
|
|
|
_TAG_VERSION: ${{ needs.setup.outputs.tag_version }}
|
2021-01-27 20:15:29 +01:00
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2021-09-02 22:04:02 +02:00
|
|
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
2021-03-15 15:28:59 +01:00
|
|
|
with:
|
|
|
|
ref: 'rc'
|
2021-01-27 20:15:29 +01:00
|
|
|
|
|
|
|
- name: Setup Chocolatey
|
|
|
|
run: choco apikey --key $env:CHOCO_API_KEY --source https://push.chocolatey.org/
|
|
|
|
env:
|
|
|
|
CHOCO_API_KEY: ${{ secrets.CHOCO_API_KEY }}
|
|
|
|
|
2021-09-02 22:04:02 +02:00
|
|
|
- name: Make dist dir
|
2021-01-28 20:35:39 +01:00
|
|
|
shell: pwsh
|
|
|
|
run: New-Item -ItemType directory -Path ./dist
|
|
|
|
|
2021-02-03 19:12:18 +01:00
|
|
|
- name: Get nupkg release asset
|
2021-09-02 22:04:02 +02:00
|
|
|
uses: Xotl/cool-github-releases@16c58a5863d6ba9944f63ca8bb78bb3249ce1d81 # v1.1.6
|
2021-01-27 20:15:29 +01:00
|
|
|
with:
|
2021-01-28 19:46:23 +01:00
|
|
|
mode: download
|
2021-09-02 22:04:02 +02:00
|
|
|
tag_name: ${{ env._TAG_VERSION }}
|
|
|
|
assets: bitwarden-cli.${{ env._PKG_VERSION }}.nupkg|./dist/bitwarden-cli.${{ env._PKG_VERSION }}.nupkg
|
2021-01-28 19:46:23 +01:00
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2021-01-27 20:15:29 +01:00
|
|
|
- name: Push to Chocolatey
|
|
|
|
shell: pwsh
|
|
|
|
run: |
|
2021-01-28 20:22:34 +01:00
|
|
|
cd dist
|
2021-01-28 22:05:17 +01:00
|
|
|
choco push
|
2021-01-27 20:15:29 +01:00
|
|
|
|
|
|
|
|
|
|
|
npm:
|
|
|
|
name: Publish NPM
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repo
|
2021-09-02 22:04:02 +02:00
|
|
|
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f # v2.3.4
|
2021-03-15 15:28:59 +01:00
|
|
|
with:
|
|
|
|
ref: 'rc'
|
2021-01-27 20:15:29 +01:00
|
|
|
|
|
|
|
- name: Setup NPM
|
|
|
|
shell: pwsh
|
|
|
|
run: |
|
|
|
|
"//registry.npmjs.org/:_authToken=${env:NPM_TOKEN}" | Out-File ".npmrc" -Encoding UTF8
|
|
|
|
env:
|
|
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
2021-09-02 22:04:02 +02:00
|
|
|
|
2021-06-30 19:17:18 +02:00
|
|
|
- name: Setup sub-module
|
|
|
|
run: npm run sub:init
|
2021-01-27 20:15:29 +01:00
|
|
|
|
2021-09-02 22:04:02 +02:00
|
|
|
- name: NPM install
|
2021-02-03 19:12:18 +01:00
|
|
|
run: npm install
|
|
|
|
|
2021-01-27 20:15:29 +01:00
|
|
|
- name: Publish NPM
|
|
|
|
run: npm run publish:npm
|