Skip to content

Commit

Permalink
🔄 Synced local '.github/workflows/' with remote '.github/workflows/'
Browse files Browse the repository at this point in the history
release-null
  • Loading branch information
cansavvy committed Jan 26, 2024
1 parent de3884d commit 4eae62e
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/delete-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

# Check out current repository
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down
22 changes: 14 additions & 8 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT }}

# Use the yaml-env-action action.
- name: Load environment from YAML
Expand All @@ -31,15 +32,17 @@ jobs:
# Make the branch fresh
- name: Make the branch fresh
run: |
git config --local user.email "[email protected]"
git config --local user.name "jhudsl-robot"
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global user.email "[email protected]"
git config --global user.name "jhudsl-robot"
branch_name='preview-${{ github.event.pull_request.number }}'
echo branch doesnt exist
git checkout -b $branch_name || echo branch exists
git push --set-upstream origin $branch_name
shell: bash


outputs:
toggle_spell_check: "${{ env.SPELL_CHECK }}"
toggle_style_code: "${{ env.STYLE_CODE }}"
Expand All @@ -58,6 +61,7 @@ jobs:
check_type: spelling
error_min: 3
gh_pat: secrets.GH_PAT
branch_name: ${GITHUB_HEAD_REF}

url-check:
name: Check URLs
Expand All @@ -68,6 +72,7 @@ jobs:
check_type: urls
error_min: 0
gh_pat: secrets.GH_PAT
branch_name: ${GITHUB_HEAD_REF}

quiz-check:
name: Check quiz formatting
Expand All @@ -78,6 +83,7 @@ jobs:
check_type: quiz_format
error_min: 0
gh_pat: secrets.GH_PAT
branch_name: ${GITHUB_HEAD_REF}

############################# Style the code ###################################
style-code:
Expand All @@ -90,7 +96,7 @@ jobs:

steps:
- name: Checkout files
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -116,16 +122,16 @@ jobs:

steps:
- name: Checkout files
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

# Set up git checkout
- name: Set up git checkout
run: |
git config --system --add safe.directory "$GITHUB_WORKSPACE"
git config --local user.email "[email protected]"
git config --local user.name "jhudsl-robot"
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global user.email "[email protected]"
git config --global user.name "jhudsl-robot"
branch_name='preview-${{ github.event.pull_request.number }}'
git fetch --all
Expand Down
62 changes: 39 additions & 23 deletions .github/workflows/render-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
paths:
- '**.Rmd'
- assets/*
- quizzes/*

jobs:

Expand All @@ -18,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

# Use the yaml-env-action action.
- name: Load environment from YAML
Expand All @@ -29,6 +30,7 @@ jobs:
toggle_bookdown: "${{ env.RENDER_BOOKDOWN }}"
toggle_coursera: "${{ env.RENDER_COURSERA }}"
toggle_leanpub: "${{ env.RENDER_LEANPUB }}"
make_book_txt: "${{ env.MAKE_BOOK_TXT }}"
rendering_docker_image: "${{ env.RENDERING_DOCKER_IMAGE }}"
toggle_quiz_check: "${{ env.CHECK_QUIZZES }}"

Expand All @@ -42,16 +44,16 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT }}

- name: Login as jhudsl-robot
run: |
git config --system --add safe.directory "$GITHUB_WORKSPACE"
git config --local user.email "[email protected]"
git config --local user.name "jhudsl-robot"
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global user.email "[email protected]"
git config --global user.name "jhudsl-robot"
# We want a fresh run of the renders each time
- name: Delete old docs/*
Expand All @@ -78,10 +80,11 @@ jobs:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
git fetch origin
git add --force docs/*
git commit -m 'Render bookdown' || echo "No changes to commit"
git pull --allow-unrelated-histories --strategy-option=ours
git push origin main || echo "No changes to push"
git push -u origin main || echo "No changes to push"
render-tocless:
name: Render TOC-less version for Leanpub or Coursera
Expand All @@ -93,15 +96,16 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
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"
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global user.email "[email protected]"
git config --global user.name "jhudsl-robot"
# Rendered content for Leanpub and Coursera is very similar.
# This job creates a shared scaffold for both.
Expand All @@ -115,10 +119,11 @@ jobs:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
git fetch origin
git add --force docs/no_toc*
git commit -m 'Render toc-less' || echo "No changes to commit"
git pull --allow-unrelated-histories --strategy-option=ours
git push origin main || echo "No changes to push"
git push -u origin main || echo "No changes to push"
render-leanpub:
name: Finish Leanpub prep
Expand All @@ -130,15 +135,16 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
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"
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global user.email "[email protected]"
git config --global user.name "jhudsl-robot"
# Create screenshots
- name: Run the screenshot creation
Expand All @@ -153,16 +159,25 @@ jobs:
--output_dir resources/chapt_screen_images)
# We want a fresh run of the renders each time
- name: Delete old manuscript/
run: rm -rf manuscript/
- name: Delete manuscript/
env:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
rm -rf manuscript/
git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
git fetch origin
git add .
git commit -m 'Delete manuscript folder' || echo "No changes to commit"
git pull --allow-unrelated-histories --strategy-option=ours
git push -u origin main || echo "No changes to push"
- name: Run ottrpal::bookdown_to_embed_leanpub
if: needs.yaml-check.outputs.toggle_quiz_check == 'no'
run: |
Rscript -e "ottrpal::bookdown_to_embed_leanpub(
render = FALSE, \
chapt_img_key = 'resources/chapt_screen_images/chapter_urls.tsv', \
make_book_txt = TRUE, \
make_book_txt = as.logical('${{needs.yaml-check.outputs.make_book_txt}}'), \
quiz_dir = NULL)"
- name: Run ottrpal::bookdown_to_embed_leanpub
Expand All @@ -171,21 +186,20 @@ jobs:
Rscript -e "ottrpal::bookdown_to_embed_leanpub(
render = FALSE, \
chapt_img_key = 'resources/chapt_screen_images/chapter_urls.tsv', \
make_book_txt = TRUE)"
make_book_txt = as.logical('${{needs.yaml-check.outputs.make_book_txt}}'))"
# Commit the rendered Leanpub files
- name: Commit rendered Leanpub files
env:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
mkdir -p manuscript
git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
git add --force manuscript/*
git add --force resources/*
git add --force docs/*
git commit -m 'Render Leanpub' || echo "No changes to commit"
git pull --allow-unrelated-histories --strategy-option=ours
git push origin main || echo "No changes to push"
git push --force --set-upstream origin main || echo "No changes to push"
render-coursera:
name: Finish Coursera prep
Expand All @@ -197,15 +211,16 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
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"
git config --global --add safe.directory $GITHUB_WORKSPACE
git config --global user.email "[email protected]"
git config --global user.name "jhudsl-robot"
# Run Coursera version
- name: Convert Leanpub quizzes to Coursera
Expand All @@ -219,9 +234,10 @@ jobs:
GH_PAT: ${{ secrets.GH_PAT }}
run: |
git remote set-url origin https://${GH_PAT}@github.com/${GITHUB_REPOSITORY}
git fetch origin
git add --force manuscript/*
git add --force resources/*
git add --force docs/*
git commit -m 'Render Coursera quizzes' || echo "No changes to commit"
git pull --allow-unrelated-histories --strategy-option=ours
git push origin main || echo "No changes to push"
git push -u origin main || echo "No changes to push"
4 changes: 2 additions & 2 deletions .github/workflows/transfer-rendered-files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

# Use the yaml-env-action action.
- name: Load environment from YAML
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
- name: Checkout code from Leanpub repo
if: ${{ steps.git_repo_check.outputs.git_results == 'TRUE' }}
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ${{ steps.git_repo_check.outputs.leanpub_repo }}
token: ${{ secrets.GH_PAT }}
Expand Down

0 comments on commit 4eae62e

Please sign in to comment.