mirror of
https://github.com/bitwarden/directory-connector
synced 2026-01-02 08:33:14 +00:00
* Added deployments to release workflow. * Removed in_progress update Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * Added in_progress initial-status Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * Added explicit expression syntax Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com> * Added explicit expression syntex on failure() Co-authored-by: Todd Martin <> Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>
133 lines
5.1 KiB
YAML
133 lines
5.1 KiB
YAML
---
|
|
name: Release
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
release_type:
|
|
description: 'Release Options'
|
|
required: true
|
|
default: 'Initial Release'
|
|
type: choice
|
|
options:
|
|
- Initial Release
|
|
- Redeploy
|
|
- Dry Run
|
|
|
|
jobs:
|
|
setup:
|
|
name: Setup
|
|
runs-on: ubuntu-20.04
|
|
steps:
|
|
- name: Branch check
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
|
run: |
|
|
if [[ "$GITHUB_REF" != "refs/heads/rc" ]] && [[ "$GITHUB_REF" != "refs/heads/hotfix-rc" ]]; then
|
|
echo "==================================="
|
|
echo "[!] Can only release from the 'rc' or 'hotfix-rc' branches"
|
|
echo "==================================="
|
|
exit 1
|
|
fi
|
|
|
|
- name: Checkout repo
|
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
|
|
|
|
- name: Retrieve Directory Connector release version
|
|
id: retrieve-version
|
|
run: |
|
|
PKG_VERSION=$(jq -r .version src/package.json)
|
|
echo "::set-output name=package_version::$PKG_VERSION"
|
|
|
|
- name: Check to make sure Mobile release version has been bumped
|
|
if: ${{ github.event.inputs.release_type == 'Initial Release' }}
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
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: Get branch name
|
|
id: branch
|
|
run: |
|
|
BRANCH_NAME=$(basename ${{ github.ref }})
|
|
echo "::set-output name=branch-name::$BRANCH_NAME"
|
|
|
|
- name: Create GitHub deployment
|
|
uses: chrnorm/deployment-action@1b599fe41a0ef1f95191e7f2eec4743f2d7dfc48
|
|
id: deployment
|
|
with:
|
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
initial-status: 'in_progress'
|
|
environment: 'production'
|
|
description: 'Deployment ${{ steps.retrieve-version.outputs.package_version }} from branch ${{ steps.branch.outputs.branch-name }}'
|
|
task: release
|
|
|
|
- name: Download all artifacts
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
|
uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8
|
|
with:
|
|
workflow: build.yml
|
|
workflow_conclusion: success
|
|
branch: ${{ steps.branch.outputs.branch-name }}
|
|
|
|
- name: Download all artifacts
|
|
if: ${{ github.event.inputs.release_type == 'Dry Run' }}
|
|
uses: bitwarden/gh-actions/download-artifacts@c1fa8e09871a860862d6bbe36184b06d2c7e35a8
|
|
with:
|
|
workflow: build.yml
|
|
workflow_conclusion: success
|
|
branch: master
|
|
|
|
- name: Create release
|
|
if: ${{ github.event.inputs.release_type != 'Dry Run' }}
|
|
uses: ncipollo/release-action@40bb172bd05f266cf9ba4ff965cb61e9ee5f6d01 # v1.9.0
|
|
env:
|
|
PKG_VERSION: ${{ steps.retrieve-version.outputs.package_version }}
|
|
with:
|
|
artifacts: "./bwdc-windows-${{ env.PKG_VERSION }}.zip,
|
|
./bwdc-macos-${{ env.PKG_VERSION }}.zip,
|
|
./bwdc-linux-${{ env.PKG_VERSION }}.zip,
|
|
./bwdc-windows-sha256-${{ env.PKG_VERSION }}.txt,
|
|
./bwdc-macos-sha256-${{ env.PKG_VERSION }}.txt,
|
|
./bwdc-linux-sha256-${{ env.PKG_VERSION }}.txt,
|
|
./Bitwarden-Connector-Portable-${{ env.PKG_VERSION }}.exe,
|
|
./Bitwarden-Connector-Installer-${{ env.PKG_VERSION }}.exe,
|
|
./Bitwarden-Connector-Installer-${{ env.PKG_VERSION }}.exe.blockmap,
|
|
./Bitwarden-Connector-${{ env.PKG_VERSION }}-x86_64.AppImage,
|
|
./Bitwarden-Connector-${{ env.PKG_VERSION }}-mac.zip,
|
|
./Bitwarden-Connector-${{ env.PKG_VERSION }}.dmg,
|
|
./Bitwarden-Connector-${{ env.PKG_VERSION }}.dmg.blockmap,
|
|
./latest-linux.yml,
|
|
./latest-mac.yml,
|
|
./latest.yml"
|
|
commit: ${{ github.sha }}
|
|
tag: v${{ env.PKG_VERSION }}
|
|
name: Version ${{ env.PKG_VERSION }}
|
|
body: "<insert release notes here>"
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
draft: true
|
|
|
|
- name: Update deployment status to Success
|
|
if: ${{ success() }}
|
|
uses: chrnorm/deployment-status@07b3930847f65e71c9c6802ff5a402f6dfb46b86
|
|
with:
|
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
state: 'success'
|
|
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|
|
|
|
- name: Update deployment status to Failure
|
|
if: ${{ failure() }}
|
|
uses: chrnorm/deployment-status@07b3930847f65e71c9c6802ff5a402f6dfb46b86
|
|
with:
|
|
token: '${{ secrets.GITHUB_TOKEN }}'
|
|
state: 'failure'
|
|
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
|