Skip to content

Commit 396c2f9

Browse files
authored
Update publish.yml
1.) Removed quarto-pub 2.) Added setup and env variables like in test.yml 3.) Added Render
1 parent 9862016 commit 396c2f9

File tree

1 file changed

+66
-25
lines changed

1 file changed

+66
-25
lines changed

.github/workflows/publish.yml

Lines changed: 66 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,69 @@
1+
name: Publish-and-Render
2+
13
on:
2-
workflow_dispatch:
3-
push:
4-
branches: main
4+
push:
5+
pull_request:
6+
branches: [main]
7+
workflow_dispatch:
8+
9+
jobs:
10+
test:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
python-version: ["3.12"]
15+
poetry-version: [latest]
16+
os: [ubuntu-latest]
17+
18+
runs-on: ${{ matrix.os }}
19+
20+
services:
21+
postgres:
22+
image: postgres:latest
23+
env:
24+
POSTGRES_DB: test_db
25+
POSTGRES_USER: postgres
26+
POSTGRES_PASSWORD: postgres
27+
ports:
28+
- 5432:5432
29+
options: >-
30+
--health-cmd pg_isready
31+
--health-interval 10s
32+
--health-timeout 5s
33+
--health-retries 5
34+
35+
steps:
36+
- uses: actions/checkout@v4
537

6-
name: Quarto Publish
7-
8-
jobs:
9-
build-deploy:
10-
runs-on: ubuntu-latest
11-
steps:
12-
- name: Check out repository
13-
uses: actions/checkout@v4
14-
15-
- name: Set up Quarto
16-
uses: quarto-dev/quarto-actions/setup@v2
17-
18-
- name: Render and Publish
19-
uses: quarto-dev/quarto-actions/publish@v2
20-
with:
21-
target: quarto-pub
22-
QUARTO_PUB_AUTH_TOKEN: ${{ secrets.QUARTO_PUB_AUTH_TOKEN }}
38+
- uses: actions/setup-python@v5
39+
with:
40+
python-version: ${{ matrix.python-version }}
41+
42+
- name: Set env variables for quarto
43+
run: |
44+
echo "DB_USER=postgres" >> $GITHUB_ENV
45+
echo "DB_PASSWORD=postgres" >> $GITHUB_ENV
46+
echo "DB_HOST=127.0.0.1" >> $GITHUB_ENV
47+
echo "DB_PORT=5432" >> $GITHUB_ENV
48+
echo "DB_NAME=test_db" >> $GITHUB_ENV
49+
echo "SECRET_KEY=$(openssl rand -base64 32)" >> $GITHUB_ENV
50+
echo "BASE_URL=http://localhost:8000" >> $GITHUB_ENV
2351
24-
# - name: Traditionally Render & Publish
25-
# run: |
26-
# quarto publish
27-
# quarto render index.qmd --output-dir . --output README.md --to gfm
28-
# unlink index.html # Can skip this step if we add/commit/push only the README rather than all changed files
52+
- name: Verify environment variables for quarto
53+
run: |
54+
echo "Checking if required environment variables are set..."
55+
[ -n "$DB_USER" ] && \
56+
[ -n "$DB_PASSWORD" ] && \
57+
[ -n "$DB_HOST" ] && \
58+
[ -n "$DB_PORT" ] && \
59+
[ -n "$DB_NAME" ] && \
60+
[ -n "$SECRET_KEY" ]
61+
62+
- name: Set up Quarto
63+
uses: quarto-dev/quarto-actions/setup@v2
64+
65+
- name: Publish
66+
uses: quarto-dev/quarto-actions/publish@v2
67+
68+
- name: Render
69+
uses: quarto-dev/quarto-actions/render@v2

0 commit comments

Comments
 (0)