-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add the polishing changes * No manage-gha * No login needed * Make it simpler for commits and pushes
- Loading branch information
Showing
18 changed files
with
148 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,33 @@ | ||
# This code was originally written by Josh Shapiro | ||
# for the Childhood Cancer Data Lab, an initiative of Alexs Lemonade Stand Foundation. | ||
# https://github.com/AlexsLemonade/refinebio-examples/blob/33cdeff66d57f9fe8ee4fcb5156aea4ac2dce07f/.github/workflows/style-and-sp-check.yml#L1 | ||
# Candace Savonen Apr 2021 | ||
|
||
# Adapted for this jhudsl repository by Candace Savonen Apr 2021 | ||
name: Build of Docker | ||
|
||
name: Test build of Dockerfile | ||
|
||
# Controls when the action will run. Triggers the workflow for a pull request for | ||
# master | ||
#---TRIGGER-START---# | ||
on: | ||
release: | ||
types: | ||
- created | ||
pull_request: | ||
branches: | ||
- 'main' | ||
branches: [ main, staging ] | ||
paths: [ docker/Dockerfile, docker/github_package_list.tsv ] | ||
workflow_dispatch: | ||
inputs: | ||
dockerhubpush: | ||
description: 'Push to Dockerhub?' | ||
required: true | ||
default: 'false' | ||
#---TRIGGER-END----# | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
build-docker: | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
- name: checkout repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: login as jhudsl-robot | ||
- name: Login as jhudsl-robot | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "jhudsl-robot" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,36 @@ | ||
|
||
# This code was originally written by Josh Shapiro and Candace Savonen | ||
# for the Childhood Cancer Data Lab, an initiative of Alexs Lemonade Stand Foundation. | ||
# https://github.com/AlexsLemonade/refinebio-examples/blob/33cdeff66d57f9fe8ee4fcb5156aea4ac2dce07f/.github/workflows/style-and-sp-check.yml#L1 | ||
# Candace Savonen Apr 2021 | ||
|
||
# Adapted for this jhudsl repository by Candace Savonen Apr 2021 | ||
name: Render Bookdown | ||
|
||
name: Render Bookdown and Coursera | ||
|
||
# Controls when the action will run. Triggers the workflow on push | ||
# events only for the master branch | ||
#---TRIGGER-START---# | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: [ main ] | ||
branches: [ main, staging ] | ||
paths: | ||
- '**.Rmd' | ||
- docker/* | ||
- assets/* | ||
#---TRIGGER-END----# | ||
|
||
jobs: | ||
# This workflow contains a single job called "build-all" | ||
render-main: | ||
render-bookdown: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: jhudsl/course_template | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
# get the full repo | ||
fetch-depth: 0 | ||
# use github PAT | ||
token: ${{ secrets.GH_PAT }} | ||
|
||
###### If you will be making changes to the Docker image to make specific to the | ||
###### course, then highlight this chunk and uncomment it. ##################### | ||
###### Recommend using short cut -- Command and / works for some editors.####### | ||
###### START OF DOCKER UPDATE CHUNK | ||
# # Login to Dockerhub | ||
# - name: Login to DockerHub | ||
# uses: docker/login-action@v1 | ||
# with: | ||
# username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
# password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
# | ||
# # Set up Docker build | ||
# - name: Set up Docker Build | ||
# uses: docker/setup-buildx-action@v1 | ||
# | ||
# - name: Get Token | ||
# run: echo ${{ secrets.GH_PAT }} > docker/git_token.txt | ||
# | ||
# # Build docker image | ||
# - name: Build Docker image | ||
# uses: docker/build-push-action@v2 | ||
# with: | ||
# push: false | ||
# load: true | ||
# context: docker | ||
# file: docker/Dockerfile | ||
# tags: jhudsl/course_template | ||
# | ||
# # Push the Docker image | ||
# - name: Push Docker image | ||
# run: docker push jhudsl/course_template | ||
|
||
###### END OF DOCKER UPDATE CHUNK ############################################## | ||
|
||
- name: Login as jhudsl-robot | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "jhudsl-robot" | ||
# We want a fresh run of the renders each time | ||
- name: Delete old docs/* | ||
run: rm -r docs/* | ||
|
@@ -75,33 +39,15 @@ jobs: | |
- name: Run bookdown render | ||
id: bookdown | ||
run: | | ||
docker run \ | ||
--mount type=bind,target=/home/rstudio,source=$PWD \ | ||
--user "$(id -u):$(id -g)" \ | ||
jhudsl/course_template \ | ||
Rscript -e "bookdown::render_book('index.Rmd', output_format = 'all'); | ||
file.copy(from = 'assets', to = 'docs/assets', overwrite = TRUE)" | ||
##### If you do not wish to host your course on Coursera, you can delete this section ##### | ||
# Run Coursera version | ||
- name: Run Coursera version of render | ||
id: coursera | ||
run: | | ||
docker run \ | ||
--mount type=bind,target=/home/rstudio,source=$PWD \ | ||
--user "$(id -u):$(id -g)" \ | ||
jhudsl/course_template \ | ||
Rscript -e "ottr::render_coursera()" | ||
##### End of Coursera rendering section ######################################## | ||
|
||
# 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.bookdown.outcome != 'success' || steps.coursera.outcome != 'success' | ||
- name: Check on render step | ||
if: steps.bookdown.outcome != 'success' | ||
run: | | ||
echo Bookdown status ${{steps.bookdown.outcome}} | ||
echo Coursera status ${{steps.coursera.outcome}} | ||
exit 1 | ||
# Commit the rendered bookdown files | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
|
||
# Candace Savonen Apr 2021 | ||
|
||
name: Render Coursera | ||
|
||
#---TRIGGER-START---# | ||
on: | ||
workflow_dispatch: | ||
workflow_run: | ||
workflows: [ "Render Bookdown" ] | ||
branches: [ main, staging ] | ||
types: | ||
- completed | ||
#---TRIGGER-END----# | ||
|
||
jobs: | ||
render-coursera: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: jhudsl/course_template | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.GH_PAT }} | ||
|
||
- name: Login as jhudsl-robot | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "jhudsl-robot" | ||
# Run Coursera version | ||
- name: Run Coursera version of render | ||
id: coursera | ||
run: Rscript -e "ottr::render_coursera(convert_quizzes = TRUE)" | ||
|
||
# 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.coursera.outcome != 'success' | ||
run: | | ||
echo Coursera status ${{steps.coursera.outcome}} | ||
exit 1 | ||
# Commit the rendered bookdown files | ||
- name: Commit rendered Coursera files | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Actions" | ||
git add --force docs/coursera/* | ||
git commit -m 'Render Coursera' || echo "No changes to commit" | ||
git push origin main || echo "No changes to push" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,54 @@ | ||
|
||
# Jan 2022 Candace Savonen | ||
|
||
name: Render and publish Leanpub | ||
name: Render Leanpub | ||
|
||
#---TRIGGER-START---# | ||
on: | ||
workflow_dispatch: | ||
### UNCOMMENT THIS SECTION IF YOU WISH PREPARE YOUR COURSE FOR LEANPUB AUTOMATICALLY | ||
# workflows: [ "Render Bookdown and Coursera" ] | ||
# branches: [ main ] | ||
# types: | ||
# - completed | ||
# paths: | ||
# - '**.Rmd' | ||
# - docker/* | ||
# - assets/* | ||
# - quizzes/* | ||
######### END OF SECTION ######### | ||
workflow_run: | ||
workflows: [ "Render Coursera" ] | ||
branches: [ main, staging ] | ||
types: | ||
- completed | ||
#---TRIGGER-END----# | ||
|
||
jobs: | ||
# This workflow contains a single job called "build-all" | ||
render-main: | ||
render-leanpub: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: jhudsl/ottr | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
# get the full repo | ||
fetch-depth: 0 | ||
# use github PAT | ||
token: ${{ secrets.GH_PAT }} | ||
|
||
# Run leanpub rendering | ||
- name: Login as jhudsl-robot | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "jhudsl-robot" | ||
# Create screenshots | ||
- name: Run the screenshot creation | ||
run: | | ||
chapt_urls=$(Rscript --vanilla scripts/make_screenshots.R \ | ||
--git_pat ${{ secrets.GH_PAT }} \ | ||
--repo $GITHUB_REPOSITORY) | ||
# We want a fresh run of the renders each time | ||
- name: Delete old manuscript/ | ||
run: rm -rf manuscript/ | ||
|
||
# Run Leanpub rendering | ||
- name: Run ottr::bookdown_to_embed_leanpub | ||
run: | | ||
rm -rf manuscript | ||
Rscript -e "ottr::bookdown_to_embed_leanpub( \ | ||
chapt_img_key = 'resources/chapt_screen_images/chapter_urls.tsv', \ | ||
make_book_txt = TRUE)" | ||
# Convert quizzes to Coursera format | ||
- name: Convert quizzes to coursera | ||
run: Rscript -e "ottr::render_coursera(convert_quizzes = TRUE)" | ||
|
||
# Commit the rendered leanpub files | ||
- name: Commit rendered leanpub files | ||
run: | | ||
|
Oops, something went wrong.