[DEVOPS-1014] Fix version auto bump workflow (#2121)

* Fix autobump

* Fix regex

* Use tag name

* DEVOPS-1014 - Review (#2123)

Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>
This commit is contained in:
Michał Chęciński 2022-10-11 16:27:07 +02:00 committed by GitHub
parent abada481b7
commit dc5698b353
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,35 +6,32 @@ on:
types: [published] types: [published]
jobs: jobs:
setup: setup:
name: "Setup" name: "Setup"
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
outputs: outputs:
version_number: ${{ steps.version.outputs.new-version }} version_number: ${{ steps.version.outputs.new-version }}
steps: steps:
- name: Checkout Branch - name: Checkout Branch
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
- name: Get version to bump - name: Calculate bumped version
id: version id: version
env: env:
RELEASE_TAG: ${{ github.event.release.tag }} RELEASE_TAG: ${{ github.event.release.tag_name }}
run: | run: |
CURR_MAJOR=$(echo $RELEASE_TAG | sed -r 's/v([0-9]{4}\.[0-9]\.)([0-9])/\1/') CURR_MAJOR=$(echo $RELEASE_TAG | sed -r 's/v([0-9]{4}\.[0-9]{1,2})\.([0-9]{1,2})/\1/')
CURR_VER=$(echo $RELEASE_TAG | sed -r 's/v([0-9]{4}\.[0-9]\.)([0-9])/\2/') CURR_PATCH=$(echo $RELEASE_TAG | sed -r 's/v([0-9]{4}\.[0-9]{1,2})\.([0-9]{1,2})/\2/')
echo $CURR_VER echo "Current Patch: $CURR_PATCH"
((CURR_VER++))
NEW_VER=$CURR_MAJOR$CURR_VER
echo $NEW_VER
NEW_PATCH=$((CURR_PATCH++))
NEW_VER=$CURR_MAJOR.$NEW_PATCH
echo "New Version: $NEW_VER"
echo "::set-output name=new-version::$NEW_VER" echo "::set-output name=new-version::$NEW_VER"
trigger_version_bump: trigger_version_bump:
name: "Trigger version bump workflow" name: "Trigger version bump workflow"
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
needs: needs:
- setup - setup
steps: steps:
@ -45,13 +42,10 @@ jobs:
- name: Retrieve secrets - name: Retrieve secrets
id: retrieve-secrets id: retrieve-secrets
env: uses: bitwarden/gh-actions/get-keyvault-secrets@c3b3285993151c5af47cefcb3b9134c28ab479af
KEYVAULT: bitwarden-prod-kv with:
SECRET: "github-pat-bitwarden-devops-bot-repo-scope" keyvault: "bitwarden-prod-kv"
run: | secrets: "github-pat-bitwarden-devops-bot-repo-scope"
VALUE=$(az keyvault secret show --vault-name $KEYVAULT --name $SECRET --query value --output tsv)
echo "::add-mask::$VALUE"
echo "::set-output name=$SECRET::$VALUE"
- name: Call GitHub API to trigger workflow bump - name: Call GitHub API to trigger workflow bump
env: env: