Skip to content

Bump version

Bump version #473

Workflow file for this run

name: Bump version
on:
workflow_run:
workflows: [ Test ]
branches: [ main, temp/hotfix ]
types: [ completed ]
workflow_dispatch:
env:
WORKFLOW_OUT_DIR: ./workflow-outputs
jobs:
bump-version:
if: |
github.ref_name == 'main' &&
(github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'success')
env:
JDK_VERSION: 21
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Run checkout github action
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
lfs: 'true'
submodules: 'true'
fetch-depth: 0
- name: Setup GitHub Runner workflow
uses: ./mobile-android-pipelines/actions/setup-runner
with:
jdk-version: 21
- name: Create a pre-release unless the workflow was triggered manually
id: pre-release
# If the workflow is triggered automatically (e.g. by merging a PR) create a pre-release
# If the workflow is triggered manually (i.e. through the Github UI) create a stable release
run: echo "enabled=$IS_AUTOMATIC_RELEASE" >> "$GITHUB_OUTPUT"
env:
IS_AUTOMATIC_RELEASE: ${{ github.event_name != 'workflow_dispatch' }}
- name: Ensure stable release is created from an existing pre-release
if: ${{ steps.pre-release.outputs.enabled == 'false' }}
uses: ./actions/ensure-pre-release-tag
- name: Increment the release version using Conventional Commits
id: versioning
uses: ./mobile-android-pipelines/actions/increment-version
with:
pre-release-type: ${{ steps.pre-release.outputs.enabled == 'true' && 'alpha' || '' }}
- name: Publish release tags
if: ${{ steps.versioning.outputs.current_version != steps.versioning.outputs.new_version }}
uses: ./mobile-android-pipelines/actions/publish-release-tag
- name: Create workflow outputs
uses: ./actions/write-bump-version-outputs
with:
current-version: ${{ steps.versioning.outputs.current_version }}
new-version: ${{ steps.versioning.outputs.new_version }}
workflow-out-dir: ${{ env.WORKFLOW_OUT_DIR }}
- name: Create GitHub release
if: steps.versioning.outputs.current_version != steps.versioning.outputs.new_version
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
with:
tag_name: ${{ steps.versioning.outputs.new_version }}
draft: false
prerelease: ${{ steps.pre-release.outputs.enabled }}
generate_release_notes: true
- name: Clean workspace
uses: ./mobile-android-pipelines/actions/clean-workspace
bump-hotfix-version:
if: |
github.ref_name == 'temp/hotfix' &&
(github.event_name == 'workflow_dispatch' ||
github.event.workflow_run.conclusion == 'success')
env:
JDK_VERSION: 21
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Run checkout github action
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
lfs: 'true'
submodules: 'true'
fetch-depth: 0
- name: Setup GitHub Runner workflow
uses: ./mobile-android-pipelines/actions/setup-runner
with:
jdk-version: 21
- name: Get version from commit message
id: get-version
uses: ./mobile-android-pipelines/actions/get-next-version-from-commit-message
- name: Increment and push hotfix git tag
id: increment-version
uses: ./mobile-android-pipelines/actions/increment-hotfix-tag
with:
version-name: ${{ steps.get-version.outputs.next-version }}
- name: Create workflow outputs
uses: ./actions/write-bump-version-outputs
with:
current-version: ${{ steps.get-version.outputs.next-version }}
new-version: ${{ steps.increment-version.outputs.incremented-version }}
workflow-out-dir: ${{ env.WORKFLOW_OUT_DIR }}
- name: Create GitHub release
if: steps.get-version.outputs.next-version != steps.increment-version.outputs.incremented-version
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
with:
tag_name: ${{ steps.increment-version.outputs.incremented-version }}
draft: false
prerelease: false
generate_release_notes: true
- name: Clean workspace
uses: ./mobile-android-pipelines/actions/clean-workspace