2022-08-02 09:34:07 +02:00
|
|
|
---
|
2022-07-29 12:18:57 +02:00
|
|
|
name: Version Auto Bump
|
|
|
|
|
|
|
|
on:
|
2022-08-02 09:34:07 +02:00
|
|
|
release:
|
|
|
|
types: [published]
|
2022-07-29 12:18:57 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
setup:
|
|
|
|
name: "Setup"
|
2022-10-11 16:27:07 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2022-08-02 09:34:07 +02:00
|
|
|
outputs:
|
|
|
|
version_number: ${{ steps.version.outputs.new-version }}
|
2022-07-29 12:18:57 +02:00
|
|
|
steps:
|
2022-08-02 09:34:07 +02:00
|
|
|
- name: Checkout Branch
|
|
|
|
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
|
|
|
|
|
2022-10-11 16:27:07 +02:00
|
|
|
- name: Calculate bumped version
|
2022-08-02 09:34:07 +02:00
|
|
|
id: version
|
|
|
|
env:
|
2022-10-11 16:27:07 +02:00
|
|
|
RELEASE_TAG: ${{ github.event.release.tag_name }}
|
2022-08-02 09:34:07 +02:00
|
|
|
run: |
|
2022-10-11 16:27:07 +02:00
|
|
|
CURR_MAJOR=$(echo $RELEASE_TAG | sed -r 's/v([0-9]{4}\.[0-9]{1,2})\.([0-9]{1,2})/\1/')
|
|
|
|
CURR_PATCH=$(echo $RELEASE_TAG | sed -r 's/v([0-9]{4}\.[0-9]{1,2})\.([0-9]{1,2})/\2/')
|
|
|
|
echo "Current Patch: $CURR_PATCH"
|
2022-08-02 09:34:07 +02:00
|
|
|
|
2022-10-11 16:27:07 +02:00
|
|
|
NEW_PATCH=$((CURR_PATCH++))
|
|
|
|
NEW_VER=$CURR_MAJOR.$NEW_PATCH
|
|
|
|
echo "New Version: $NEW_VER"
|
2022-08-02 09:34:07 +02:00
|
|
|
echo "::set-output name=new-version::$NEW_VER"
|
|
|
|
|
|
|
|
trigger_version_bump:
|
|
|
|
name: "Trigger version bump workflow"
|
2022-10-11 16:27:07 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2022-08-02 09:34:07 +02:00
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
steps:
|
|
|
|
- name: Login to Azure
|
|
|
|
uses: Azure/login@ec3c14589bd3e9312b3cc8c41e6860e258df9010
|
|
|
|
with:
|
|
|
|
creds: ${{ secrets.AZURE_PROD_KV_CREDENTIALS }}
|
|
|
|
|
|
|
|
- name: Retrieve secrets
|
|
|
|
id: retrieve-secrets
|
2022-10-11 16:27:07 +02:00
|
|
|
uses: bitwarden/gh-actions/get-keyvault-secrets@c3b3285993151c5af47cefcb3b9134c28ab479af
|
|
|
|
with:
|
|
|
|
keyvault: "bitwarden-prod-kv"
|
|
|
|
secrets: "github-pat-bitwarden-devops-bot-repo-scope"
|
2022-08-02 09:34:07 +02:00
|
|
|
|
|
|
|
- name: Call GitHub API to trigger workflow bump
|
|
|
|
env:
|
|
|
|
TOKEN: ${{ steps.retrieve-secrets.outputs.github-pat-bitwarden-devops-bot-repo-scope }}
|
|
|
|
VERSION: ${{ needs.setup.outputs.version_number}}
|
|
|
|
run: |
|
|
|
|
JSON_STRING=$(printf '{"ref":"master", "inputs": { "version_number":"%s"}}' "$VERSION")
|
|
|
|
curl \
|
|
|
|
-X POST \
|
|
|
|
-i -u bitwarden-devops-bot:$TOKEN \
|
|
|
|
-H "Accept: application/vnd.github.v3+json" \
|
|
|
|
https://api.github.com/repos/bitwarden/mobile/actions/workflows/version-bump.yml/dispatches \
|
|
|
|
-d $JSON_STRING
|