generated from rpodcast/r_dev_projects
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- '**.qmd' | ||
- '**.R' | ||
workflow_dispatch: | ||
|
||
name: build-dash | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build-dash: | ||
runs-on: ubuntu-latest | ||
env: | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
RENV_PATHS_ROOT: ~/.local/share/renv | ||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Quarto | ||
uses: quarto-dev/quarto-actions/setup@v2 | ||
with: | ||
version: pre-release | ||
|
||
- uses: r-lib/actions/setup-r@v2 | ||
|
||
- name: Add Ubuntu dependencies | ||
run: sudo apt-get install libglpk40 | ||
|
||
- uses: r-lib/actions/setup-renv@v2 | ||
|
||
- name: Cache targets data | ||
uses: actions/cache@v3 | ||
with: | ||
path: _targets | ||
key: ${{ runner.os }}-targets-v1-${{ hashFiles('**/cache.log') }} | ||
restore-keys: | | ||
${{ runner.os }}-targets-v1- | ||
- name: Build Pipeline and Dashboard | ||
run: Rscript -e 'targets::tar_make()' | ||
|
||
- name: Was the dashboard updated? | ||
id: dashboard-updated | ||
run: | | ||
if [[ $(git status --porcelain -- index.html index_files/) ]]; then | ||
echo "has_update=true" >> "$GITHUB_OUTPUT" | ||
fi | ||
- name: Push Built Dashboard | ||
if: steps.dashboard-updated.outputs.has_update == 'true' | ||
run: | | ||
git config --global user.name 'gha update bot' | ||
git config --global user.email '[email protected]' | ||
git add --all | ||
git commit --allow-empty -m "[auto] Build Dashboard $(TZ=America/New_York date +'%Y-%m-%d %H:%M')" | ||
git push | ||
- name: Render and Publish to GH Pages | ||
if: steps.dashboard-updated.outputs.has_update == 'true' | ||
uses: quarto-dev/quarto-actions/publish@v2 | ||
with: | ||
target: gh-pages | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|