Skip to content

Commit

Permalink
build: added workflow to automatically bump package version
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kolomanski committed Jan 23, 2025
1 parent 5211678 commit 56bb3a5
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Bump Package Version

on:
pull_request:
types: [closed]
branches:
- main

jobs:
bump_version:
name: Bump package version
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Bump version
shell: bash
run: |
current_version=$(grep -E '^Version:' DESCRIPTION | awk '{print $2}')
IFS='.' read -r -a version_parts <<< "$current_version"
version_parts[${#version_parts[@]}-1]=$((version_parts[${#version_parts[@]}-1]+1))
new_version=$(IFS=.; echo "${version_parts[*]}")
sed -i "s/^Version: .*/Version: $new_version/" DESCRIPTION
# Commit the changes
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git commit -am "Bump version to $new_version"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main

0 comments on commit 56bb3a5

Please sign in to comment.