Skip to content

Return the generated filetoken from request_file_analysis (#29) #23

Return the generated filetoken from request_file_analysis (#29)

Return the generated filetoken from request_file_analysis (#29) #23

Workflow file for this run

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: 4.0.0
- name: Install dependencies
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: devtools, usethis
- name: Bump 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\")"
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 -a -m "[skip ci] Release $new_version"
git push
- name: GitHub release
run: Rscript -e 'usethis::use_github_release()'
env:
GITHUB_PAT: ${{ secrets.RELEASE_TOKEN }}