Skip to content

Commit cff4610

Browse files
bburns632jameslamb
andauthored
Button Push Website Build from Last Version Tag (#327)
Co-authored-by: James Lamb <jaylamb20@gmail.com>
1 parent 84a3cf4 commit cff4610

File tree

2 files changed

+21
-19
lines changed

2 files changed

+21
-19
lines changed

.github/workflows/website.yaml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,24 @@ on:
88
workflow_dispatch:
99

1010
jobs:
11-
version_check:
12-
name: Confirm Whole Version Number
13-
runs-on: macos-latest
14-
steps:
15-
- name: checkout repository
16-
uses: actions/checkout@v4
17-
- name: Grep Version in DESCRIPTION
18-
shell: bash
19-
run: grep -E "Version:\s\d+\.\d+\.\d+$" $GITHUB_WORKSPACE/DESCRIPTION
2011
build-website:
21-
name: build website PR
22-
needs: [version_check]
12+
name: build website docs on website_docs_update branch
2313
runs-on: macos-latest
2414
steps:
2515
- name: checkout repository
2616
uses: actions/checkout@v4
2717
with:
28-
fetch-depth: 1
18+
fetch-depth: 0 # pull all tags and other history
19+
- name: Get Latest Version Tag
20+
id: previoustag
21+
uses: WyriHaximus/github-action-get-previous-tag@v1.4.0
22+
with:
23+
prefix: 'v'
24+
- name: Git Checkout Branch From Latest Version Tag
25+
run: |
26+
git config --local user.name "$GITHUB_ACTOR"
27+
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
28+
git checkout -b website_docs_update ${{steps.previoustag.outputs.tag}}
2929
- name: set up R
3030
uses: r-lib/actions/setup-r@v2
3131
with:
@@ -38,11 +38,13 @@ jobs:
3838
- name: Build Site
3939
run: pkgdown::build_site()
4040
shell: Rscript {0}
41-
- name: Commit website doc changes
41+
- name: Save Site Docs Articfact
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: "built_website_docs_${{steps.previoustag.outputs.tag}}"
45+
path: ${{github.workspace}}/docs/
46+
- name: Commit website doc changes (overwrite if existing)
4247
run: |
43-
git config --local user.name "$GITHUB_ACTOR"
44-
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
4548
git add docs/\*
46-
git commit -m "Update website documentation" || echo "No changes to commit"
47-
git pull --ff-only
48-
git push origin
49+
git commit -m "Update website documentation to ${{steps.previoustag.outputs.tag}}" || echo "No changes to commit"
50+
git push -f origin website_docs_update

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ Add some notes explaining what has changed since the previous release (usually a
346346

347347
### Update the Website
348348

349-
Adding the new version tag in the previous step should have triggered a Github Action to build the website docs and create a PR. If not, manually trigger the workflow and create a PR to update the docs. Merge that in!
349+
Adding the new version tag in the previous step should have triggered a Github Action to build the website docs and create a branch named `website_docs_update`. Review and merge.
350350

351351
### Open a new PR to begin development on the next version
352352

0 commit comments

Comments
 (0)