Skip to content

Commit 03970dc

Browse files
committed
Create bump-dev-version.yaml
1 parent cfa373d commit 03970dc

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Bump Dev Version
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'DESCRIPTION'
9+
10+
jobs:
11+
bump-version:
12+
runs-on: ubuntu-latest
13+
if: "!contains(github.event.head_commit.message, 'Bump version')"
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Setup R
22+
uses: r-lib/actions/setup-r@v2
23+
24+
- name: Install usethis
25+
run: Rscript -e 'install.packages("usethis")'
26+
27+
- name: Check if Dev Version and Bump
28+
run: |
29+
# Extract version from DESCRIPTION
30+
VERSION=$(grep '^Version:' DESCRIPTION | awk '{print $2}')
31+
32+
# Check if version has 4 components (e.g., 1.0.0.9000)
33+
if [[ $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
34+
echo "Dev version detected ($VERSION). Bumping..."
35+
36+
# Configure git
37+
git config --local user.name "github-actions[bot]"
38+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
39+
40+
# Run the bump
41+
Rscript -e 'usethis::use_version(which = "dev")'
42+
43+
# Commit and push
44+
git add DESCRIPTION
45+
git commit -m "Bump version [skip ci]"
46+
git push
47+
else
48+
echo "Stable version detected ($VERSION). Skipping bump."
49+
fi

0 commit comments

Comments
 (0)