1
0
mirror of https://github.com/bitwarden/desktop.git synced 2024-11-25 12:06:07 +01:00
bitwarden-desktop/.github/workflows/deploy.yml

158 lines
4.7 KiB
YAML
Raw Normal View History

2021-01-26 23:21:24 +01:00
name: Deploy
on:
2021-01-29 20:09:59 +01:00
workflow_dispatch:
inputs:
release_tag_name_input:
description: "Release Tag Name <X.X.X>"
required: true
2021-01-26 23:21:24 +01:00
release:
types:
2021-01-29 20:09:59 +01:00
- published
2021-01-26 23:21:24 +01:00
jobs:
2021-01-26 23:42:04 +01:00
setup:
2021-01-26 23:21:24 +01:00
runs-on: ubuntu-latest
2021-01-26 23:42:04 +01:00
outputs:
2021-01-29 20:09:59 +01:00
package_version: ${{ steps.create_tags.outputs.package_version }}
tag_version: ${{ steps.create_tags.outputs.tag_version }}
2021-01-26 23:21:24 +01:00
steps:
- name: Checkout Repo
uses: actions/checkout@v2
2021-01-29 20:09:59 +01:00
- name: Create Deploy version vars
id: create_tags
2021-01-26 23:42:04 +01:00
run: |
2021-01-29 20:09:59 +01:00
if ! [[ "${{ github.event_name }}" -eq "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}
2021-01-26 23:42:04 +01:00
2021-01-29 20:09:59 +01:00
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 }}
2021-01-26 23:42:04 +01:00
2021-01-29 20:09:59 +01:00
snap:
name: Deploy Snap
2021-01-26 23:42:04 +01:00
runs-on: ubuntu-latest
2021-01-26 23:49:46 +01:00
needs: setup
2021-01-29 20:09:59 +01:00
env:
PKG_VERSION: ${{ needs.setup.outputs.package_version }}
TAG_VERSION: ${{ needs.setup.ouputs.tag_version }}
2021-01-26 23:42:04 +01:00
steps:
- name: Checkout Repo
uses: actions/checkout@v2
2021-01-29 20:09:59 +01:00
- name: Install Snap
uses: samuelmeuli/action-snapcraft@v1
with:
snapcraft_token: ${{ secrets.SNAP_TOKEN }}
2021-01-26 23:42:04 +01:00
2021-01-29 20:09:59 +01:00
- name: setup
run: mkdir dist
- name: get snap package
uses: Xotl/cool-github-releases@v1
with:
mode: download
tag_name: ${{ env.TAG_VERSION }}
assets: bitwarden_${{ env.PKG_VERSION }}_amd64.snap|./dist/bitwarden_${{ env.PKG_VERSION }}_amd64.snap
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: test
run: ls -alht dist
- name: Deploy to Snap Store
run: |
snapcraft upload dist/bitwarden_${{ env.PACKAGE_VERSION }}_amd64.snap --release stable
snapcraft logout
choco:
name: Deploy Choco
runs-on: windows-latest
needs: setup
env:
PKG_VERSION: ${{ needs.setup.outputs.package_version }}
TAG_VERSION: ${{ needs.setup.outputs.tag_version }}
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Get choco release asset
uses: dsaltares/fetch-gh-release-asset@0.0.5
with:
2021-01-27 00:54:09 +01:00
version: tags/${{ env.TAG_VERSION }}
2021-01-29 20:09:59 +01:00
file: bitwarden.${{ env.PKG_VERSION }}.nupkg
2021-01-26 23:49:46 +01:00
env:
2021-01-29 20:09:59 +01:00
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2021-01-26 23:21:24 +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-01-29 20:09:59 +01:00
- name: make dist dir
shell: pwsh
run: New-Item -ItemType directory -Path ./dist
2021-01-26 23:42:04 +01:00
2021-01-29 20:09:59 +01:00
- name: Get nupkg
uses: Xotl/cool-github-releases@v1
with:
mode: download
tag_name: ${{ env.TAG_VERSION }}
assets: bitwarden.${{ env.PKG_VERSION }}.nupkg|./dist/bitwarden.${{ env.PKG_VERSION }}.nupkg
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Push to Chocolatey
shell: pwsh
run: |
cd dist
choco push
macos:
runs-on: macos-latest
needs: setup
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: make target directory
run: mkdir -p dist/mas
- name: Get mac release asset
uses: Xotl/cool-github-releases@v1
2021-01-29 20:09:59 +01:00
with:
mode: download
tag_name: ${{ env.TAG_VERSION }}
assets: Bitwarden-${{ env.PACKAGE_VERSION }}.pkg|./dist/mas/Bitwarden-${{ env.PACKAGE_VERSION }}.pkg
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy to App Store
run: npm run upload:mas
env:
APPLE_ID_USERNAME: ${{ secrets.APPLE_ID_USERNAME }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}