|
| 1 | +name: Publish-and-Render |
| 2 | + |
1 | 3 | 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 |
5 | 37 |
|
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 |
23 | 51 |
|
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