Update Version Bump workflow inputs (#6143)

This commit is contained in:
Vince Grassia 2023-09-05 16:52:03 -04:00 committed by GitHub
parent 255a7381b3
commit d6aa85af66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 68 additions and 48 deletions

View File

@ -44,4 +44,5 @@ jobs:
uses: ./.github/workflows/version-bump.yml uses: ./.github/workflows/version-bump.yml
with: with:
version_number: ${{ needs.setup.outputs.version_number }} version_number: ${{ needs.setup.outputs.version_number }}
client: "Desktop" bump_desktop: true
secrets: inherit

View File

@ -4,16 +4,22 @@ name: Version Bump
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
client: bump_browser:
description: "Client Project" description: "Browser Project Version Bump"
required: true type: boolean
type: choice default: false
options: bump_cli:
- Browser description: "CLI Project Version Bump"
- CLI type: boolean
- Desktop default: false
- Web bump_desktop:
- All description: "Desktop Project Version Bump"
type: boolean
default: false
bump_web:
description: "Web Project Version Bump"
type: boolean
default: false
version_number: version_number:
description: "New Version" description: "New Version"
required: true required: true
@ -23,9 +29,10 @@ on:
version_number: version_number:
required: true required: true
type: string type: string
client: bump_desktop:
required: true description: "Desktop Project Version Bump"
type: string type: boolean
default: false
defaults: defaults:
run: run:
@ -33,8 +40,8 @@ defaults:
jobs: jobs:
bump_version: bump_version:
name: "Bump ${{ github.event.inputs.client }} Version" name: "Bump Version"
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
steps: steps:
- name: Checkout Branch - name: Checkout Branch
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
@ -42,7 +49,7 @@ jobs:
- name: Login to Azure - Prod Subscription - name: Login to Azure - Prod Subscription
uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7 uses: Azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2 # v1.4.7
with: with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }} creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
- name: Retrieve secrets - name: Retrieve secrets
id: retrieve-secrets id: retrieve-secrets
@ -62,13 +69,27 @@ jobs:
- name: Create Version Branch - name: Create Version Branch
id: branch id: branch
env: env:
CLIENT_NAME: ${{ github.event.inputs.client }} VERSION: ${{ inputs.version_number }}
VERSION: ${{ github.event.inputs.version_number }}
run: | run: |
CLIENT=$(python -c "print('$CLIENT_NAME'.lower())") CLIENTS=()
echo "client=$CLIENT" >> $GITHUB_OUTPUT if [[ ${{ inputs.bump_browser }} == true ]]; then
CLIENTS+=("browser")
fi
if [[ ${{ inputs.bump_cli }} == true ]]; then
CLIENTS+=("cli")
fi
if [[ ${{ inputs.bump_desktop }} == true ]]; then
CLIENTS+=("desktop")
fi
if [[ ${{ inputs.bump_web }} == true ]]; then
CLIENTS+=("web")
fi
printf -v joined '%s,' "${CLIENTS[@]}"
echo "client=${joined%,}" >> $GITHUB_OUTPUT
git switch -c ${CLIENT}_version_bump_${VERSION} BRANCH=version_bump_${VERSION}_${GITHUB_SHA:0:7}
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
git switch -c ${BRANCH}
######################## ########################
# VERSION BUMP SECTION # # VERSION BUMP SECTION #
@ -76,27 +97,27 @@ jobs:
### Browser ### Browser
- name: Bump Browser Version - name: Bump Browser Version
if: ${{ github.event.inputs.client == 'Browser' || github.event.inputs.client == 'All' }} if: ${{ inputs.bump_browser == true }}
env: env:
VERSION: ${{ github.event.inputs.version_number }} VERSION: ${{ inputs.version_number }}
run: npm version --workspace=@bitwarden/browser ${VERSION} run: npm version --workspace=@bitwarden/browser ${VERSION}
- name: Bump Browser Version - Manifest - name: Bump Browser Version - Manifest
if: ${{ github.event.inputs.client == 'Browser' || github.event.inputs.client == 'All' }} if: ${{ inputs.bump_browser == true }}
uses: bitwarden/gh-actions/version-bump@67ab95d7a466bcefdedf3f93cbc10bcff436edfe uses: bitwarden/gh-actions/version-bump@67ab95d7a466bcefdedf3f93cbc10bcff436edfe
with: with:
version: ${{ github.event.inputs.version_number }} version: ${{ inputs.version_number }}
file_path: "apps/browser/src/manifest.json" file_path: "apps/browser/src/manifest.json"
- name: Bump Browser Version - Manifest v3 - name: Bump Browser Version - Manifest v3
if: ${{ github.event.inputs.client == 'Browser' || github.event.inputs.client == 'All' }} if: ${{ inputs.bump_browser == true }}
uses: bitwarden/gh-actions/version-bump@67ab95d7a466bcefdedf3f93cbc10bcff436edfe uses: bitwarden/gh-actions/version-bump@67ab95d7a466bcefdedf3f93cbc10bcff436edfe
with: with:
version: ${{ github.event.inputs.version_number }} version: ${{ inputs.version_number }}
file_path: "apps/browser/src/manifest.v3.json" file_path: "apps/browser/src/manifest.v3.json"
- name: Run Prettier after Browser Version Bump - name: Run Prettier after Browser Version Bump
if: ${{ github.event.inputs.client == 'Browser' || github.event.inputs.client == 'All' }} if: ${{ inputs.bump_browser == true }}
run: | run: |
npm install -g prettier npm install -g prettier
prettier --write apps/browser/src/manifest.json prettier --write apps/browser/src/manifest.json
@ -104,30 +125,30 @@ jobs:
### CLI ### CLI
- name: Bump CLI Version - name: Bump CLI Version
if: ${{ github.event.inputs.client == 'CLI' || github.event.inputs.client == 'All' }} if: ${{ inputs.bump_cli == true }}
env: env:
VERSION: ${{ github.event.inputs.version_number }} VERSION: ${{ inputs.version_number }}
run: npm version --workspace=@bitwarden/cli ${VERSION} run: npm version --workspace=@bitwarden/cli ${VERSION}
### Desktop ### Desktop
- name: Bump Desktop Version - Root - name: Bump Desktop Version - Root
if: ${{ github.event.inputs.client == 'Desktop' || github.event.inputs.client == 'All' }} if: ${{ inputs.bump_desktop == true }}
env: env:
VERSION: ${{ github.event.inputs.version_number }} VERSION: ${{ inputs.version_number }}
run: npm version --workspace=@bitwarden/desktop ${VERSION} run: npm version --workspace=@bitwarden/desktop ${VERSION}
- name: Bump Desktop Version - App - name: Bump Desktop Version - App
if: ${{ github.event.inputs.client == 'Desktop' || github.event.inputs.client == 'All' }} if: ${{ inputs.bump_desktop == true }}
env: env:
VERSION: ${{ github.event.inputs.version_number }} VERSION: ${{ inputs.version_number }}
run: npm version ${VERSION} run: npm version ${VERSION}
working-directory: "apps/desktop/src" working-directory: "apps/desktop/src"
### Web ### Web
- name: Bump Web Version - name: Bump Web Version
if: ${{ github.event.inputs.client == 'Web' || github.event.inputs.client == 'All' }} if: ${{ inputs.bump_web == true }}
env: env:
VERSION: ${{ github.event.inputs.version_number }} VERSION: ${{ inputs.version_number }}
run: npm version --workspace=@bitwarden/web-vault ${VERSION} run: npm version --workspace=@bitwarden/web-vault ${VERSION}
######################## ########################
@ -151,27 +172,26 @@ jobs:
if: ${{ steps.version-changed.outputs.changes_to_commit == 'TRUE' }} if: ${{ steps.version-changed.outputs.changes_to_commit == 'TRUE' }}
env: env:
CLIENT: ${{ steps.branch.outputs.client }} CLIENT: ${{ steps.branch.outputs.client }}
VERSION: ${{ github.event.inputs.version_number }} VERSION: ${{ inputs.version_number }}
run: git commit -m "Bumped ${CLIENT} version to ${VERSION}" -a run: git commit -m "Bumped ${CLIENT} version to ${VERSION}" -a
- name: Push changes - name: Push changes
if: ${{ steps.version-changed.outputs.changes_to_commit == 'TRUE' }} if: ${{ steps.version-changed.outputs.changes_to_commit == 'TRUE' }}
env: env:
CLIENT: ${{ steps.branch.outputs.client }} BRANCH: ${{ steps.branch.outputs.branch }}
VERSION: ${{ github.event.inputs.version_number }} run: git push -u origin ${BRANCH}
run: git push -u origin ${CLIENT}_version_bump_${VERSION}
- name: Create Bump Version PR - name: Create Bump Version PR
if: ${{ steps.version-changed.outputs.changes_to_commit == 'TRUE' }} if: ${{ steps.version-changed.outputs.changes_to_commit == 'TRUE' }}
env: env:
PR_BRANCH: "${{ steps.branch.outputs.client }}_version_bump_${{ github.event.inputs.version_number }}"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
BASE_BRANCH: master BASE_BRANCH: master
TITLE: "Bump ${{ github.event.inputs.client }} version to ${{ github.event.inputs.version_number }}" BRANCH: ${{ steps.branch.outputs.branch }}
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
TITLE: "Bump ${{ steps.branch.outputs.client }} version to ${{ inputs.version_number }}"
run: | run: |
gh pr create --title "$TITLE" \ gh pr create --title "$TITLE" \
--base "$BASE" \ --base "$BASE_BRANCH" \
--head "$PR_BRANCH" \ --head "$BRANCH" \
--label "version update" \ --label "version update" \
--label "automated pr" \ --label "automated pr" \
--body " --body "
@ -183,5 +203,4 @@ jobs:
- [X] Other - [X] Other
## Objective ## Objective
Automated ${{ github.event.inputs.client }} version bump to ${{ github.event.inputs.version_number }}" Automated ${{ steps.branch.outputs.client }} version bump to ${{ inputs.version_number }}"