Skip to content

Commit

Permalink
squash-me, tag images with hash, not date, and handle PR builds diffe…
Browse files Browse the repository at this point in the history
…rently
  • Loading branch information
jiridanek committed May 31, 2024
1 parent 1294a2a commit 6e21ada
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 43 deletions.
21 changes: 20 additions & 1 deletion .github/workflows/build-notebooks-TEMPLATE.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,16 @@ name: Build & Publish Notebook Servers (TEMPLATE)
"on":
workflow_call:
inputs:
# https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables
# https://docs.github.com/en/actions/learn-github-actions/contexts
target:
required: true
description: "make target to build"
type: string
github:
required: true
description: "top workflow's `github`"
type: string

jobs:
build:
Expand Down Expand Up @@ -54,10 +60,23 @@ jobs:
# podman bug? need to create this _after_ doing the reset
mkdir -p /mnt/containers/tmp
- run: "make ${{ inputs.target }}"
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#push
- name: "push: make ${{ inputs.target }}"
run: "make ${{ inputs.target }}"
if: "${{ fromJson(inputs.github).event_name == 'push' }}"
env:
IMAGE_TAG: "${{ github.ref_name }}_${{ github.sha }}"
IMAGE_REGISTRY: "ghcr.io/${{ github.repository }}/workbench-images"
CACHE: "ghcr.io/${{ github.repository }}/workbench-images/build-cache"

# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
- name: "pull_request: make ${{ inputs.target }}"
run: "make ${{ inputs.target }}"
if: "${{ fromJson(inputs.github).event_name == 'pull_request' }}"
env:
IMAGE_TAG: "${{ github.ref_name }}_${{ github.sha }}"
IMAGE_REGISTRY: "ghcr.io/${{ github.repository }}/workbench-images/pr${{ fromJson(inputs.github).event.number }}"
CACHE: "ghcr.io/${{ github.repository }}/workbench-images/build-cache"

- run: df -h
if: "${{ !cancelled() }}"
Loading

0 comments on commit 6e21ada

Please sign in to comment.