diff --git a/.github/workflows/render-site.yml b/.github/workflows/render-site.yml new file mode 100644 index 0000000..acc3063 --- /dev/null +++ b/.github/workflows/render-site.yml @@ -0,0 +1,82 @@ +# This code was originally adapted by Candace Savonen for the OTTR_template https://github.com/jhudsl/OTTR_Template. + +# This code was adapted by Carrie Wright to enable automated rendering of the site associated with this repository. + +name: Render html + +# Controls when the action will run. Triggers the workflow on push +# events only for the master branch +on: + workflow_dispatch: + push: + branches: [ main ] + paths: + - '**.Rmd' + - styles.css + - _site.yml + - resources/images/*.png + - resources/icons/*.png + +jobs: + yaml-check: + name: Load user automation choices + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + # Use the yaml-env-action action. + - name: Load environment from YAML + uses: doughepi/yaml-env-action@v1.0.0 + with: + files: config_automation.yml # Pass a space-separated list of configuration files. Rightmost files take precedence. + + outputs: + rendering_docker_image: "${{ env.RENDERING_DOCKER_IMAGE }}" + + # This workflow contains a single job called "build-all" + render-main: + needs: yaml-check + runs-on: ubuntu-latest + container: + image: ${{needs.yaml-check.outputs.rendering_docker_image}} + + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: checkout + uses: actions/checkout@v4 + with: + # get the full repo + fetch-depth: 0 + # use github PAT + token: ${{ secrets.GH_PAT }} + + # We want a fresh run of the renders each time - so first delete old html files + - name: Delete old *.html + run: Rscript -e "rmarkdown::clean_site(preview = FALSE)" + + # Now we want to render all the html files from the Rmd files + - name: Run render html + id: site + run: Rscript -e "rmarkdown::render_site()" + + # This checks on the steps before it and makes sure that they completed. + # If the renders didn't complete we don't want to commit the file changes + - name: Check on render steps + if: steps.site.outcome != 'success' + run: | + echo site status ${{steps.site.outcome}} + exit 1 + +# Commit the rendered site files - html files and site_libs files +# The git reset step will remove any other files created in this workflow, such as API keys + - name: Commit rendered site files + run: | + git config --global --add safe.directory $GITHUB_WORKSPACE + git config --global user.name 'github-actions[bot]' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' + git add --force docs/* + git commit -m 'Render site' || echo "No changes to commit" + git reset --hard HEAD + git pull --rebase --allow-unrelated-histories --strategy-option=ours + git push origin main || echo "No changes to push" diff --git a/resources/images/basic_otter_water.PNG b/resources/images/basic_otter_water.PNG new file mode 100644 index 0000000..521ae31 Binary files /dev/null and b/resources/images/basic_otter_water.PNG differ diff --git a/resources/images/github.png b/resources/images/github.png new file mode 100644 index 0000000..a93acd3 Binary files /dev/null and b/resources/images/github.png differ diff --git a/resources/images/warning.png b/resources/images/warning.png new file mode 100644 index 0000000..405fb61 Binary files /dev/null and b/resources/images/warning.png differ diff --git a/style.css b/style.css new file mode 100644 index 0000000..63febad --- /dev/null +++ b/style.css @@ -0,0 +1,135 @@ +/*------------- checkbox alignment for html checkbox---------------- */ +ul { + list-style-position: inside; + padding-left: 0; + font-weight: normal +} + + + +/*------------- checkbox alignment for markdown checkbox---------------- */ + +input[type="checkbox"] { + margin-right: 0.5ch; + } + + +/*------------- GitHub boxes that look like the buttons on GitHub---------------- */ + +.github_button { + border-radius: 8px; + border: 1px solid #black; + background: #20873e; + color: white !important; + box-shadow: 0 12px 16px 0 rgba(0,0,0,0.24), 0 17px 50px 0 rgba(0,0,0,0.19); + padding: 8px 16px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + margin: 4px 2px; + transition-duration: 0.4s; + cursor: pointer; +} + +/*------------- button link color---------------- */ + + +.github_button a:link{ + color: #fff; +} + + +/*------------- box around title and title font ---------------- */ + +.title { + font-family: 'Avenir'; + font-size: 4em !important; + color: #193a5c; + margin-top: 0.275em !important; + margin-bottom: 0.35em !important; + border-radius: 8px; + border: 4px solid #986753; + background: #90ceff; + color: #565a59; + padding: 8px 16px; + text-align: center; + width: 500px; + margin: auto; +} + +/*-----------icon------*/ + +.icon{ + width: 3%; +} + +} + +/*------------- Body and header text---------------- */ + +.book.font-family-1 { + font-family: 'Karla', arial, sans-serif; +} + +/*------------- Change header color---------------- */ + +h1, h2, h3 { + font-family: 'Lora', arial, sans-serif; + color:#5ca5ff; +} + +/*------------- Change link color---------------- */ + +a { + color: #0598a8; +} + +/*------------- Numbering for header level 2 ---------------- */ + +body { + counter-reset: h2; +} +h2::before { + counter-increment: h2; + content: counter(h2) ". "; +} + +/*------------- add warning and github boxes---------------- */ + + +div.warning{ + border: 4px #e0471c; + border-style: solid; + padding: 1em; + margin: 1em 0; + padding-left: 100px; + background-size: 70px; + background-repeat: no-repeat; + background-position: 15px center; + min-height: 120px; + background-color: #e8ebee; +} + +div.warning{ + background-image: url("resources/images/warning.png"); +} + +div.github{ + border: 4px #000000; + border-style: solid; + padding: 1em; + margin: 1em 0; + padding-left: 100px; + background-size: 70px; + background-repeat: no-repeat; + background-position: 15px center; + min-height: 120px; + background-color: #e8ebee; +} + +div.github{ + background-image: url("resources/images/github.png"); +} + + diff --git a/template.Rmd b/template.Rmd new file mode 100644 index 0000000..c16a41a --- /dev/null +++ b/template.Rmd @@ -0,0 +1,38 @@ +--- +title: | +
Cheatsheet
+

template

+date: "Last updated: `r format(Sys.time(), '%B %d, %Y')`" +output: html_document +css: style.css +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = TRUE) +``` + + +## R Markdown + + adfasfd + + afdafsd + + +[this is a link](https://www.itcrtraining.org/) + +::: {.warning} +warning test +::: + +:::{.github_button} + Use this template +::: + + Use this template + +
+ + + +
diff --git a/website_setup.Rmd b/website_setup.Rmd new file mode 100644 index 0000000..437a175 --- /dev/null +++ b/website_setup.Rmd @@ -0,0 +1,92 @@ +--- +title: | +
OTTR Website
+

Setup

+date: "Last updated: `r format(Sys.time(), '%B %d, %Y')`" +output: html_document +css: style.css +--- + +```{r setup, include=FALSE} +knitr::opts_chunk$set(echo = TRUE) +``` + + +## Create your OTTR repository from the [OTTR_Template_Website repository](OTTR_Template_Website repository) + + In the upper right, _click on_:
Use this template
+ + Set your repo to **Public** + +## Enable workflow actions + + In your OTTR repository, go to **Settings** in the top navigation tabs + + Go to **Actions** (General) in the side navigation + + Under **Workflow permissions** + +1. Select **Read and write permissions** + +2. Check **Allow GitHub Actions to create and approve pull requests** + +3. Click **Save** + +## Set up your GitHub personal access token + +A. [Create a personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) + + Click on your **profile photo** in the upper right profile icon + + Go to **Settings**settings icon + + Go to **Developer Settings** in the side navigation developer settings icon + + Select **Generate new token (classic)** personal access token icon + + Underneath **Select Scopes**, *check both* **repo** and **workflow** + + Click:
Generate Token
+ + Copy the **personal access token** copy icon + +B. [Save the copied personal access token as a repository secret](https://docs.github.com/en/codespaces/managing-codespaces-for-your-organization/managing-development-environment-secrets-for-your-repository-or-organization#adding-secrets-for-a-repository) + + In your OTTR repository, go to **Settings** in the top navigation tabs settings icon + + Go to **Secrets and variables** in the side navigation secrets icon + + Click on **Actions** + + Under **Repository secrets**, click on
New repository secrets
+ + Under **Name**, enter **GH_PAT** + + For **Secret**, paste your copied personal access token + + Click on:
Add secret
+ +## Set up GitHub Pages + + In your OTTR repository, go to Settings in the top navigation tabs secrets icon + + Go to **Pages** in the side navigation pages icon + + In the **Build and deployment section** + + 1. Under **Source**, select **Deply from a branch** + 2. Under **Branch**, pick **main** and choose **/docs**, and click **Save** + + at the botton of the page, check **Enforce HTTPS** + + +## Enroll your OTTR repository for template updates + + Refer to our Template Updates Cheatsheet + + +
+ + + +