Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
fc42259
fixed README usage info
jennylsmith Feb 24, 2025
5a37c98
pull request test for dev into main
jennylsmith Jan 29, 2025
0d21a15
modify checkout step for PR; make PR draft-only
jennylsmith Jan 29, 2025
29c34ee
added ready_for_review trigger
jennylsmith Jan 29, 2025
190cdc7
updated the base branch and added an example variable step in the dep…
jennylsmith Feb 24, 2025
5c818e0
change workflow name and set to dispatch trigger
jennylsmith Feb 25, 2025
f210eb3
include on push test branch
jennylsmith Feb 25, 2025
4d4e210
set deploy env to dev
jennylsmith Feb 25, 2025
782fcd0
remove BRANCH variable since default github vars not accessible in en…
jennylsmith Feb 25, 2025
58554f4
added if statement to determine whether the deploy job should be run
jennylsmith Feb 25, 2025
d605c61
use single quotes in conditional statement
jennylsmith Feb 25, 2025
662f611
deploy if branch is main
jennylsmith Feb 25, 2025
3ad63d4
determine how to set RUN_PR_STEP value in the vars context
jennylsmith Feb 25, 2025
6120b98
change conditional to check if strings match
jennylsmith Feb 25, 2025
c00ec28
fix type-o in yml format
jennylsmith Feb 25, 2025
87fee02
change conditional value to test to a string for PR job
jennylsmith Feb 25, 2025
ebafb56
remove if statement
jennylsmith Feb 25, 2025
56d8bc5
move env block to the specific step
jennylsmith Feb 25, 2025
758dc37
use default credentials for checkout in PR
jennylsmith Feb 25, 2025
b7b274a
if statement to determine if PR job should be run
jennylsmith Feb 25, 2025
cbf7ba6
added ssh key for checkout step in PR job
jennylsmith Feb 25, 2025
8b98d9b
look at the default settings of PR
jennylsmith Feb 25, 2025
183d6df
set branch in PR
jennylsmith Feb 25, 2025
2f722a6
set ref in checkout step to main
jennylsmith Feb 25, 2025
b30a963
checkout the main_pr_test branch and see if that sets main_pr_test as…
jennylsmith Feb 25, 2025
98e4fe1
specify branch in create-pull-request step
jennylsmith Feb 25, 2025
ad8bb92
add actions cache if artifacts are built
jennylsmith Feb 25, 2025
93189ad
use OUTPUT_DIR env var to generate a cache key
jennylsmith Feb 25, 2025
d52e8b8
use OUTPUT_DIR env var to generate a cache key. fix input to hashFile…
jennylsmith Feb 25, 2025
48d816b
use OUTPUT_DIR env var to generate a cache key. fix input to hashFile…
jennylsmith Feb 25, 2025
276fe01
specify search dir for hashFiles function and check the output of the…
jennylsmith Feb 25, 2025
ddc50e4
fix variable syntax for hashFiles function
jennylsmith Feb 25, 2025
750abf4
change CACHE_PATH and add double quotes to DEBUG env variable
jennylsmith Feb 25, 2025
0577c28
move cache step to end of build job
jennylsmith Feb 25, 2025
a1641ed
try using save and restore cache steps
jennylsmith Feb 25, 2025
be52e9d
added gh cli PR create
jennylsmith Feb 25, 2025
1b4ffc2
fix standard input for gh cli
jennylsmith Feb 26, 2025
f2aee96
added --body argument to pr
jennylsmith Feb 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 89 additions & 46 deletions .github/workflows/quarto.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,12 @@
name: quarto website
name: quarto-website

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the specified branches
push:
branches: [ "main", "dev" ]
# pull_request:
# branches: [ "main", "dev" ]

# # Allows you to run this workflow manually from the Actions tab
# workflow_dispatch:

# Debugging log info
# https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/troubleshooting-workflows/enabling-debug-logging

# temporarily use conditional statement to skip PR while troubleshooting
# env: A map of variables that are available to the steps of all jobs in the workflow.
# The env context contains variables that have been set in a workflow, job, or step.
# env:
# RUN_PR_STEP: "${{ false }}"

# The vars context contains custom configuration variables set at the organization, repository, and environment levels.
# repository or environment variables can be set on Github or the GH Actions extension in VSCode
# https://github.com/jennylsmith/jennylsmith.github.io/settings/variables/actions
# if statements can only access thse expression contexts: github, inputs, vars, needs
branches: [ "main", "dev", "main_pr_test", "dev_pr_test"]
# Allows you to run this workflow manually from the Actions tab or gh CLI
workflow_dispatch:

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
Expand All @@ -33,7 +16,7 @@ concurrency:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
contents: write
pages: write
id-token: write
pull-requests: write
Expand All @@ -46,65 +29,125 @@ jobs:
runs-on: ubuntu-latest
env:
QUARTO_VERSION: 1.5.57
OUTPUT_DIR: docs
CACHE_PATH: '**/docs/*.*'

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# install quarto
- name: install quarto CLI
run: |
wget -O ${{ runner.temp }}/quarto.deb https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/quarto.deb

# checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: checkout
uses: actions/checkout@v4

# setup gh pages
- name: setup pages
id: pages
uses: actions/configure-pages@v5

- name: restore artifacts
id: cache-artifacts
uses: actions/cache/restore@v4
with:
path: ${{ env.OUTPUT_DIR }}
key: ${{ github.ref_name }}-${{ github.sha }}-key

# install quarto
- name: install quarto CLI
if: steps.cache-artifacts.outputs.cache-hit != 'true'
run: |
wget -O ${{ runner.temp }}/quarto.deb --quiet https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/quarto.deb

# render the website
- name: render website
if: steps.cache-artifacts.outputs.cache-hit != 'true'
run: quarto render

# upload the rendered website (artifact)
- name: upload artifact
id: artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./docs
path: ${{ env.OUTPUT_DIR }}

# cache rendered website artifacts
- name: Cache Artifacts
id: create-cache
uses: actions/cache/save@v4
with:
path: ${{ env.OUTPUT_DIR }}
key: ${{ github.ref_name }}-${{ github.sha }}-key

# pull request
# https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs
pull_request:
if: ${{ vars.RUN_PR_STEP == true }}
if: ${{ github.ref_name == 'dev_pr_test' }}
needs: build
runs-on: ubuntu-latest
environment:
name: dev
env:
BASE: main_pr_test
steps:
- name: checkout
uses: actions/checkout@v4
- name: create pull request
id: cpr
uses: peter-evans/create-pull-request@v7
with:
commit-message: "merge dev into main"
branch: dev
base: pr_actions_test
assignees: jennylsmith
reviewers: jennylsmith

token: ${{ secrets.GH_PAT }}
ref: main_pr_test
- name: gh-cli-pr
run: |
echo ${{ secrets.GH_PAT }} | gh auth login --with-token && \
gh pr create -B $BASE -H ${{ github.ref_name }} --title "PR for ${{ github.sha }} on RUN_ID ${{ github.run_id }}" --body "PR for ${{ github.sha }}" --draft && \
gh auth logout
# - name: gh-cli-pr
# run:

# - name: create-pull-request
# id: cpr
# uses: peter-evans/create-pull-request@v7
# with:
# commit-message: merge dev into main
# title: PR from ${{ github.run_id }}
# draft: always-true
# branch: ${{ github.ref }}

# deploy job
deploy:
if: ${{ github.ref_name == 'main' }}
# Add a dependency to the job
needs: build
# add and if statement later? ${{ github.event.repository.default_branch }}
# Deploy to the github-pages environment
# Settings and variables here: https://github.com/jennylsmith/jennylsmith.github.io/settings/environments
# environment:
# name: github-pages
# url: ${{ steps.deployment.outputs.page_url }}
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

name: dev
# Specify runner
runs-on: ubuntu-latest
# deploy to gh pages
steps:
- name: deploy to GitHub pages
id: deployment
uses: actions/deploy-pages@v4
- name: "vars example"
run: |
echo "the gh branch that triggered the workflow is $GITHUB_REF_NAME"
echo "debug set to $ACTIONS_RUNNER_DEBUG"
# - name: deploy to GitHub pages
# id: deployment
# uses: actions/deploy-pages@v4


#### NOTES

# Debugging log info
# https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/troubleshooting-workflows/enabling-debug-logging

# temporarily use conditional statement to skip PR while troubleshooting
# env: A map of variables that are available to the steps of all jobs in the workflow.
# The env context contains variables that have been set in a workflow, job, or step.
# env:
# RUN_PR_STEP: "${{ false }}"

# The vars context contains custom configuration variables set at the organization, repository, and environment levels.
# repository or environment variables can be set on Github or the GH Actions extension in VSCode
# https://github.com/jennylsmith/jennylsmith.github.io/settings/variables/actions
# if statements can only access thse expression contexts: github, inputs, vars, needs
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ using the following command in a terminal:
quarto preview --render all --no-watch-inputs --no-browse
```

For new features or fixes, create an issue on github in a new branch.
For new features or fixes, create an issue on github and create a new branch with the changes.

Then open a pull request using `gh` commandline utility to merge changes into the `dev` branch, like the example below for issue #4.

Expand Down