Skip to content

Carpentries build workflows - #8

Merged
douglowe merged 5 commits into
mainfrom
build-carpentries
Oct 29, 2026
Merged

douglowe merged 5 commits into
mainfrom
build-carpentries

Conversation

@douglowe

Copy link
Copy Markdown
Member

This is the full carpentries build system, which I've tested on my own repository, and it works okay. I think we should adopt this in full, rather than trying to trim it down, otherwise we will very quickly get out of date as we find we can't update to their latest workflows.

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ WARNING ⚠️

This pull request contains a mix of workflow files and regular files. This could be malicious. No preview will be created.

regular files:

  • .github/workbench-docker-version.txt
  • .github/workflows/README.md
  • .github/workflows/workflows-version.txt

workflow files:

  • .github/workflows/check-ruleset.yaml
  • .github/workflows/docker_apply_cache.yaml
  • .github/workflows/docker_build_deploy.yaml
  • .github/workflows/docker_pr_receive.yaml
  • .github/workflows/pr-close-signal.yaml
  • .github/workflows/pr-comment.yaml
  • .github/workflows/pr-post-remove-branch.yaml
  • .github/workflows/pr-preflight.yaml
  • .github/workflows/pr-receive.yaml
  • .github/workflows/sandpaper-main.yaml
  • .github/workflows/update-cache.yaml
  • .github/workflows/update-workflows.yaml

@github-actions

Copy link
Copy Markdown
Contributor

Changes were made to copyright notices

There are copyright updates on the (temporary) add-license-headers-to-build-carpentries-2026-10-29-16-55-02 branch. Please review and merge, or add further commits (this branch will be deleted).

Comment on lines +33 to +50
name: "Preflight: PR or Manual Trigger?"
runs-on: ubuntu-latest
outputs:
do-apply: ${{ steps.check.outputs.merged_or_manual }}
steps:
- name: "Should we run cache application?"
id: check
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ||
("${{ github.ref }}" == "refs/heads/main" && "${{ github.event.action }}" == "closed" && "${{ github.event.pull_request.merged }}" == "true") ]]; then
echo "merged_or_manual=true" >> $GITHUB_OUTPUT
else
echo "This was not a manual trigger and no PR was merged. No action taken."
echo "merged_or_manual=false" >> $GITHUB_OUTPUT
fi
shell: bash

check-renv:
Comment on lines +51 to +66
name: "Check If We Need {renv}"
runs-on: ubuntu-latest
needs: preflight
if: needs.preflight.outputs.do-apply == 'true'
outputs:
renv-needed: ${{ steps.check-for-renv.outputs.renv-needed }}
renv-cache-hashsum: ${{ steps.check-for-renv.outputs.renv-cache-hashsum }}
steps:
- name: "Check for renv"
id: check-for-renv
uses: carpentries/actions/renv-checks@v1
with:
WORKBENCH_TAG: ${{ vars.WORKBENCH_TAG || 'latest' }}
skip-cache-check: true

no-renv-cache-used:
Comment on lines +67 to +75
name: "No renv package dependency image needed"
runs-on: ubuntu-latest
needs: check-renv
if: needs.check-renv.outputs.renv-needed != 'true'
steps:
- name: "No dependency image needed"
run: echo "No renv dependency image needed for this lesson"

update-renv-cache:
Comment on lines +174 to +190
name: "Record Caching Status"
runs-on: ubuntu-latest
needs: [check-renv, update-renv-cache]
if: always()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: "Record cache result"
run: |
echo "${{ needs.check-renv.outputs.renv-needed != 'true' || needs.update-renv-cache.result == 'success' }}" > ${{ github.workspace }}/apply-cache-result
shell: bash

- name: "Upload cache result"
uses: actions/upload-artifact@v7
with:
name: apply-cache-result
path: ${{ github.workspace }}/apply-cache-result
Comment on lines +45 to +76
name: "Preflight: Schedule, Push, or PR?"
runs-on: ubuntu-latest
outputs:
do-build: ${{ steps.build-check.outputs.do-build }}
renv-needed: ${{ steps.build-check.outputs.renv-needed }}
renv-cache-hashsum: ${{ steps.build-check.outputs.renv-cache-hashsum }}
dependency-image-ref: ${{ steps.build-check.outputs.dependency-image-ref }}
workbench-container-file-exists: ${{ steps.wb-vers.outputs.workbench-container-file-exists }}
wb-vers: ${{ steps.wb-vers.outputs.container-version }}
last-wb-vers: ${{ steps.wb-vers.outputs.last-container-version }}
workbench-update: ${{ steps.wb-vers.outputs.workbench-update }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: "Should we run build and deploy?"
id: build-check
uses: carpentries/actions/build-preflight@v1

- name: "Checkout Lesson"
if: steps.build-check.outputs.do-build == 'true'
uses: actions/checkout@v6

- name: "Get container version info"
id: wb-vers
if: steps.build-check.outputs.do-build == 'true'
uses: carpentries/actions/container-version@v1
with:
WORKBENCH_TAG: ${{ vars.WORKBENCH_TAG }}
renv-needed: ${{ steps.build-check.outputs.renv-needed }}
token: ${{ secrets.GITHUB_TOKEN }}

full-build:
Comment on lines 35 to +57
@@ -33,50 +52,44 @@ jobs:
echo "ok=false" >> $GITHUB_OUTPUT
echo "Not Running Today"
fi
shell: bash

check_renv:
name: "Check if We Need {renv}"
runs-on: ubuntu-22.04
check-renv:
name: "Check If We Need {renv}"
runs-on: ubuntu-latest
needs: preflight
if: ${{ needs.preflight.outputs.ok == 'true'}}
if: ${{ needs.preflight.outputs.ok == 'true' }}
@douglowe
douglowe merged commit 355569a into main Oct 29, 2026
11 of 13 checks passed
@douglowe
douglowe deleted the build-carpentries branch October 29, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants