Skip to content

Auto Bump Patch

Auto Bump Patch #46

Workflow file for this run

name: Auto Bump Patch
on:
release:
types: [prereleased]
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Bump version in tauri.conf.json and tauri.android.conf.json
id: bump_version
run: |
CURRENT_VERSION=$(jq -r '.version' src-tauri/tauri.conf.json)
IFS='.' read -r -a VERSION_PARTS <<< "$CURRENT_VERSION"
MAJOR=${VERSION_PARTS[0]}
MINOR=${VERSION_PARTS[1]}
PATCH=${VERSION_PARTS[2]}
NEW_PATCH=$((PATCH + 1))
NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH"
jq --indent 4 ".version = \"$NEW_VERSION\"" src-tauri/tauri.conf.json > src-tauri/tauri.conf.json.tmp && mv src-tauri/tauri.conf.json.tmp src-tauri/tauri.conf.json
jq --indent 4 ".version = \"$NEW_VERSION\"" src-tauri/tauri.android.conf.json > src-tauri/tauri.android.conf.json.tmp && mv src-tauri/tauri.android.conf.json.tmp src-tauri/tauri.android.conf.json
echo "new_version=$NEW_VERSION" >> "$GITHUB_ENV"
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7
with:
token: ${{ secrets.PAT }}
commit-message: "chore(version) : bump to ${{ env.new_version }}"
sign-commits: true
base: main
branch: chore/bump-version-${{ env.new_version }}
branch-suffix: random
labels: |
chore
automated pr
delete-branch: true
title: "chore(version): bump version to ${{ env.new_version }}"
draft: false
- name: Enable Pull Request Automerge
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@a660677d5469627102a1c1e11409dd063606628d # v3
with:
token: ${{ secrets.PAT }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: squash