Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial release workflow #14

Merged
merged 8 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.github
^cran-comments\.md$
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: release
on:
push:
branches: [main]
jobs:
test:
name: Test for release
if: startsWith(github.event.head_commit.message, '[release:minor]') ||
startsWith(github.event.head_commit.message, '[release:major]') ||
startsWith(github.event.head_commit.message, '[release:patch]')
uses: flowr-analysis/flowr-r-adapter/.github/workflows/test.yml@main

release:
runs-on: ubuntu-latest
needs: [test]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.RELEASE_TOKEN }}
- name: Configure git user
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"

- name: Install R
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.r-version }}
- name: Install dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
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)"
env:
# putting the message into an env variable first sanitizes it
MESSAGE: ${{ github.event.head_commit.message }}

- name: GitHub release
run: Rscript -e 'usethis::use_github_release()'
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
pull_request:
types: [opened, synchronize]
branches: [main]
workflow_call:
jobs:
devtools-check:
strategy:
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# flowr 0.0.1

* Added a `NEWS.md` file to track changes to the package.
5 changes: 5 additions & 0 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## R CMD check results

0 errors | 0 warnings | 1 note

* This is a new release.