-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (50 loc) · 1.69 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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: CRAN Release
run: |
R --no-save --ess --interactive << EOF
devtools::submit_cran()
EOF
- name: GitHub release
run: Rscript -e 'usethis::use_github_release()'