Skip to content

Commit

Permalink
Actions deployment (#1)
Browse files Browse the repository at this point in the history
* adding files for actions deployment

* adding files for actions deployment

* ci: Use GitHub Actions site deployment

* Add GitHub Actions based publishing of the website using GitHub Actions as the
  publishing source for GitHub Pages.

* docs: Update README with publishing notes

---------

Co-authored-by: Matthew Feickert <[email protected]>
  • Loading branch information
i-baumann and matthewfeickert authored Jul 6, 2024
1 parent ad23a5f commit 3f71bbf
Show file tree
Hide file tree
Showing 8 changed files with 3,027 additions and 4 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Publish site

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Quarto
uses: quarto-dev/quarto-actions/setup@v2

- name: Install R
uses: r-lib/actions/setup-r@v2
with:
r-version: '4.4.0'

- name: Install R Dependencies
uses: r-lib/actions/setup-renv@v2
with:
cache-version: 1

- name: Render Quarto Project
uses: quarto-dev/quarto-actions/render@v2
with:
to: html

- name: List site structure
run: tree -L 2 docs/

- name: Fix permissions if needed
run: |
chmod -c -R +rX "docs/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'docs/'

deploy:
name: Deploy docs to GitHub Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build
# Set permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest

steps:
- name: Setup Pages
uses: actions/configure-pages@v5

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*.Rproj
.Rproj.user/
.DS_Store
.Rprofile

# Directories
/.quarto/
/.quarto/
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,13 @@

In Spring 2024 the [Open Source Program Office at UW-Madison](https://ospo.wisc.edu/) distributed an open source survey to gauge the usage of open source tools among members of the university community, identify open source projects under development, and to collect feedback on improving the open source environment at UW-Madison. This repo is for a [Quarto site](https://quarto.org/) for summarizing and presenting results from the survey.

This site uses the [UW Quarto site template](https://github.com/UW-Madison-DSI/uw_quarto_site_template). University theming can be customized using the `custom.scss` and `setup.R` files. Plot theming is generally handled in `setup.R`. Other customizations, such as highlighting specific open source tools in response plots, are handled in the appropriate page files (such as `usage.qmd`).
This site uses the [UW Quarto site template](https://github.com/UW-Madison-DSI/uw_quarto_site_template). University theming can be customized using the `custom.scss` and `setup.R` files. Plot theming is generally handled in `setup.R`. Other customizations, such as highlighting specific open source tools in response plots, are handled in the appropriate page files (such as `usage.qmd`).

### Building the Site On GitHub Pages

Quarto sites can be deployed to GitHub Pages either by 1) rendering the site locally and pushing the updated repo to GitHub with Pages set to deploy the site from the `docs` directory or 2) by using GitHub Actions to render the site when pushing updates to the repo. See [Quarto's documentation on deploying Quarto sites to GitHub Pages](https://quarto.org/docs/publishing/github-pages.html#publish-command) for more detail.

This repo is currently configured to use GitHub Actions to deploy the site using the [`quarto-dev/quarto-actions/render`](https://github.com/quarto-dev/quarto-actions/tree/main/render) GitHub Action and using GitHub Actions as the [publishing source for GitHub Pages][GitHub pages publishing source].
Changes to the site will be automatically deployed from merged PRs to the `main` branch.

[GitHub pages publishing source]: https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-with-a-custom-github-actions-workflow
Loading

0 comments on commit 3f71bbf

Please sign in to comment.