Skip to content

Commit

Permalink
ci: commit and push manually in release
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellpeck committed Aug 8, 2024
1 parent 201e1ec commit 8c9085c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,25 @@ jobs:
extra-packages: devtools, usethis

- name: Bump version
id: version
run: |
step=$(echo "$MESSAGE" | sed -n -E 's/\[release:(patch|minor|major)].*/\1/p')
if [ -z "$step" ]; then
echo "fatal: Release step not found in commit message."
exit 1
fi
Rscript -e "usethis::use_version(\"$step\", push = TRUE)"
Rscript -e "usethis::use_version(\"$step\")"
env:
# putting the message into an env variable first sanitizes it
MESSAGE: ${{ github.event.head_commit.message }}

# we have to do this manually since use_version only commits and pushes if it's interactive for some reason
- name: Commit and push
run: |
new_version=$(sed -n -E "s/Version: (.*)/\1/p" DESCRIPTION)
git commit -m "[skip ci] Release $new_version"
git push
- name: GitHub release
run: Rscript -e 'usethis::use_github_release()'
env:
Expand Down

0 comments on commit 8c9085c

Please sign in to comment.