-
Notifications
You must be signed in to change notification settings - Fork 69
84 lines (71 loc) · 2.24 KB
/
release.yaml
File metadata and controls
84 lines (71 loc) · 2.24 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
on:
push:
tags:
- 'v*'
name: Release
jobs:
R-CMD-check:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check
- uses: r-lib/actions/check-r-package@v2
release:
needs: R-CMD-check
runs-on: ubuntu-latest
permissions:
contents: write
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check
- name: Validate version matches tag
run: |
TAG_VERSION="${GITHUB_REF_NAME#v}"
DESC_VERSION=$(grep '^Version:' DESCRIPTION | sed 's/Version: *//')
if [ "$TAG_VERSION" != "$DESC_VERSION" ]; then
echo "::error::Tag version ($TAG_VERSION) does not match DESCRIPTION version ($DESC_VERSION)"
exit 1
fi
echo "VERSION=$TAG_VERSION" >> "$GITHUB_ENV"
- name: Extract release notes from NEWS.md
run: |
# Extract the section for this version from NEWS.md
VERSION="$VERSION"
awk -v ver="$VERSION" '
/^# scRepertoire VERSION / {
if (found) exit
if (index($0, ver)) { found=1; next }
}
found { print }
' NEWS.md > release_notes.md
if [ ! -s release_notes.md ]; then
echo "No release notes found for version $VERSION in NEWS.md"
echo "Release of scRepertoire $VERSION" > release_notes.md
fi
- name: Build source tarball
run: R CMD build .
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "$GITHUB_REF_NAME" \
--title "scRepertoire $VERSION" \
--notes-file release_notes.md \
scRepertoire_*.tar.gz