-
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.
#3 add gh action yaml for deploy previews with netlify
- Loading branch information
Showing
1 changed file
with
67 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,67 @@ | ||
on: | ||
pull_request: | ||
branches: [main] | ||
issue_comment: | ||
types: [created] | ||
|
||
name: Quarto Deploy Preview | ||
|
||
jobs: | ||
delete-bot-comments: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: pr-deleter | ||
uses: maheshrayas/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
org: ${{ github.repository_owner }} | ||
repo: ${{ github.event.repository.name }} | ||
user: "github-actions[bot]" | ||
issue: ${{ github.event.number }} | ||
|
||
build-deploy-preview: | ||
# Deploy a preview only if | ||
# - the event is a PR | ||
# - the PR is not from a fork | ||
if: | | ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork != true) | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup R | ||
uses: r-lib/actions/setup-r@v2 | ||
with: | ||
use-public-rspm: true | ||
|
||
- uses: r-lib/actions/setup-r-dependencies@v2 | ||
|
||
- name: Set up Quarto | ||
uses: quarto-dev/quarto-actions/setup@v2 | ||
|
||
- name: Render | ||
uses: quarto-dev/quarto-actions/render@v2 | ||
|
||
- name: Deploy Preview to Netlify as preview | ||
id: netlify-deploy | ||
uses: nwtgck/actions-netlify@v2 | ||
env: | ||
NETLIFY_SITE_ID: d9dd191c-8f69-45bd-8b31-ed6129366828 | ||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | ||
with: | ||
publish-dir: "./_site" | ||
production-deploy: false | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
deploy-message: | | ||
Deploy from GHA: ${{ github.event.pull_request.title || format('manual from PR {0}', github.event.issue.number) }} | ||
alias: deploy-preview-${{ github.event.pull_request.number || github.event.issue.number }} | ||
enable-pull-request-comment: true | ||
enable-commit-comment: false | ||
enable-commit-status: true | ||
overwrites-pull-request-comment: false | ||
timeout-minutes: 1 |