-
Notifications
You must be signed in to change notification settings - Fork 13
208 lines (180 loc) · 5.95 KB
/
pushrelease.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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
on:
pull_request:
types:
- closed
branches:
- main
name: Release
jobs:
render:
name: Update README.md and Vignettes
runs-on: macOS-latest
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
r-version: release
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 2
extra-packages: |
any::remotes
any::rmarkdown
any::knitr
any::purrr
local::.
- name: Render README.md and Vignettes
run: Rscript './vignettes/precompile.R'
- name: Commit and push changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
git add \*.R
git add \*.Rmd
git add \*.png
git add README.md
git commit -m 'precompile Vignettes and README.md' || echo "No changes to commit"
git push origin main || echo "No changes to push"
fi
build:
name: Build for ${{ matrix.config.os }} (${{ matrix.config.r }})
needs: render
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {os: macOS-latest, r: 'release', artifact_name: '*.tar.gz', asset_name: macOS}
- {os: windows-latest, r: 'release', artifact_name: '*.zip', asset_name: winOS}
- {os: ubuntu-latest, r: 'release', artifact_name: '*.tar.gz', asset_name: linuxOS}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 2
extra-packages: |
any::rcmdcheck
any::covr
any::remotes
needs: check
- uses: r-lib/actions/check-r-package@v2
env:
_R_CHECK_FORCE_SUGGESTS_: false
with:
upload-snapshots: true
- name: Document
run: Rscript -e 'roxygen2::roxygenise()'
- name: Build binary
run: |
pkgbuild::clean_dll()
binary <- pkgbuild::build(binary = TRUE, needs_compilation = TRUE, compile_attributes = TRUE)
dir.create("build")
file.copy(binary, "build")
shell: Rscript {0}
- name: Save binary artifact
if: success()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.config.asset_name }}
path: build/
- name: Calculate code coverage
if: runner.os == 'macOS-latest'
run: Rscript -e "covr::codecov()"
release:
name: Bump version and release
needs: build
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout one
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.merge_commit_sha }}
fetch-depth: '0'
- name: Bump version and push tag
id: newtag
uses: anothrNick/github-tag-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
PRERELEASE: false
DEFAULT_BUMP: patch
RELEASE_BRANCHES: main
- name: Checkout two
uses: actions/checkout@v4
- name: Extract version
run: |
echo "PACKAGE_VERSION=$(grep '^Version' DESCRIPTION | sed 's/.*: *//')" >> $GITHUB_ENV
echo "PACKAGE_NAME=$(grep '^Package' DESCRIPTION | sed 's/.*: *//')" >> $GITHUB_ENV
- name: Download binaries
uses: actions/download-artifact@v4
- name: Rename binaries release
shell: bash
run: |
ls -R
cp ./macOS/${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }}*.tgz .
cp ./linuxOS/${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }}*.tar.gz .
cp ./winOS/${{ env.PACKAGE_NAME }}_${{ env.PACKAGE_VERSION }}*.zip .
echo "Renamed files"
ls goldfish_*
- name: Create Release and Upload Assets
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.newtag.outputs.tag }}
name: Release ${{ steps.newtag.outputs.tag }}
draft: false
prerelease: false
fail_on_unmatched_files: true
# Specify the assets you want to upload
files: |
goldfish_*.tgz
goldfish_*.tar.gz
goldfish_*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
pkgdown:
name: Build pkgdown site
needs: render
runs-on: macOS-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 2
extra-packages: |
any::rcmdcheck
any::pkgdown
local::.
needs: website
- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE, examples = FALSE)
shell: Rscript {0}
- name: Deploy to GitHub pages 🚀
uses: JamesIves/github-pages-deploy-action@v4
with:
clean: false
branch: gh-pages
folder: docs