Skip to content

Commit

Permalink
ci: comment site preview
Browse files Browse the repository at this point in the history
  • Loading branch information
tdstein committed Jun 10, 2024
1 parent e98d4de commit 206a460
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 27 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/docs.yaml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/site.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Site
on:
- pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
default:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: 3.x
check-latest: true
cache: 'pip'
- uses: quarto-dev/quarto-actions/setup@v2
- run: make deps
- run: make dev
- run: make docs
- uses: actions/setup-node@v4
- id: netlify
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
run: |
preview_url=$(make --silent -C ./docs netlify | tail -n 1)
echo "::set-output preview_url::$preview_url"
- uses: actions/github-script@v6
env:
preview_url: ${{ steps.netlify.outputs.preview_url }}
with:
script: |
const url = process.env.preview_url;
const issue_number = context.payload.pull_request.number;
const repo = context.repo.repo;
const owner = context.repo.owner;
github.rest.issues.createComment({
owner,
repo,
issue_number,
body: `🚀 Preview your changes [here](${url})`
})
5 changes: 5 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ QUARTO ?= quarto
QUARTODOC ?= quartodoc

# Environment variables
NETLIFY_SITE_ID ?= 5cea1f56-7935-4387-975a-18a7905d15ee
CURRENT_YEAR ?= $(shell date +%Y)
VERSION ?= $(shell make --silent -C ../ version | tail -n 1)

Expand Down Expand Up @@ -41,3 +42,7 @@ preview:
CURRENT_YEAR=$(CURRENT_YEAR) \
VERSION=$(VERSION) \
$(QUARTO) preview


netlify:
NETLIFY_SITE_ID=$(NETLIFY_SITE_ID) npx -y netlify-cli deploy --dir _site --json | jq '.deploy_url'

0 comments on commit 206a460

Please sign in to comment.