-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from jhudsl/cansavvy/lets-see
Making adding new images to the github actions easier
- Loading branch information
Showing
6 changed files
with
160 additions
and
240 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Candace Savonen Apr 2025 | ||
name: 'Build Docker Image' | ||
description: 'Build and push from a dockerfile in the repository' | ||
inputs: | ||
directory: | ||
description: "What's the file path to this Dockerfile's folder in this repo" | ||
required: true | ||
type: string | ||
tag: | ||
description: 'What is this called on Dockerhub? e.g. jhudsl/base_ottr' | ||
required: true | ||
type: string | ||
dockerhubpush: | ||
description: 'Should this be pushed to Dockerhub?' | ||
required: false | ||
default: 'false' | ||
type: string | ||
token: | ||
description: 'A GitHub Personal Access Token' | ||
required: false | ||
dockerhub_username: | ||
description: 'A Dockerhub username that has access to this image' | ||
required: false | ||
dockerhub_token: | ||
description: 'A Dockerhub token that has persmissions to push to this image' | ||
required: false | ||
|
||
outputs: | ||
success: | ||
value: ${{ steps.push.outcome }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ inputs.token }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Login to Docker Hub | ||
if: ${{ inputs.dockerhubpush != 'false' }} | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ inputs.dockerhub_username }} | ||
password: ${{ inputs.dockerhub_token }} | ||
|
||
- name: Build | ||
id: push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: ${{ inputs.dockerhubpush }} | ||
context: ${{ inputs.directory }} | ||
file: ${{ inputs.directory }}/Dockerfile | ||
platforms: linux/amd64 | ||
tags: ${{ inputs.tag }} |
This file was deleted.
Oops, something went wrong.
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,4 +1,4 @@ | ||
# Candace Savonen May 2022 | ||
# Candace Savonen Jan 2025 | ||
|
||
name: Pull Request | ||
|
||
|
@@ -8,95 +8,43 @@ on: | |
|
||
jobs: | ||
|
||
dockerfiles-changed: | ||
name: Detect changed Dockerfiles | ||
dockerfile-check: | ||
name: Detect changed Dockerfile - ${{ matrix.config.dir }} | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- {dir: base_ottr, name: 'jhudsl/base_ottr'} | ||
- {dir: bioconductor, name: 'jhudsl/ottr_bioconductor'} | ||
- {dir: ottrpal, name: 'jhudsl/ottrpal'} | ||
- {dir: ottr_anvil_poll, name: 'jhudsl/anvil-poll-2024'} | ||
- {dir: ottr_datatables, name: 'jhudsl/ottr_datatables'} | ||
- {dir: ottr_website, name: 'jhudsl/ottr_website'} | ||
# NEW IMAGES HERE: # | ||
####### - {dir: directory_path, name: 'name its called on dockerhub'} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get specific changed files | ||
id: base_ottr | ||
id: image_name | ||
uses: tj-actions/[email protected] | ||
with: | ||
files: base_ottr/* | ||
files: ${{ matrix.config.dir }}/* | ||
|
||
- name: Get specific changed files | ||
id: ottrpal | ||
uses: tj-actions/[email protected] | ||
with: | ||
files: ottrpal/* | ||
- run: echo ${{steps.image_name.outputs.any_changed}} | ||
|
||
- name: Get specific changed files | ||
id: bioconductor | ||
uses: tj-actions/[email protected] | ||
- name: Docker build | ||
if: ${{ steps.image_name.outputs.any_changed == 'true'}} | ||
uses: ./.github/workflows/ | ||
with: | ||
files: bioconductor/* | ||
|
||
- run: | | ||
echo ${{steps.base_ottr.outputs.any_changed}} | ||
echo ${{steps.ottrpal.outputs.any_changed}} | ||
echo ${{steps.bioconductor.outputs.any_changed}} | ||
outputs: | ||
base_ottr_changed: ${{steps.base_ottr.outputs.any_changed}} | ||
ottrpal_changed: ${{steps.ottrpal.outputs.any_changed}} | ||
bioconductor_changed: ${{steps.bioconductor.outputs.any_changed}} | ||
|
||
build-base: | ||
name: Build base ottr image | ||
needs: dockerfiles-changed | ||
if: ${{needs.dockerfiles-changed.outputs.base_ottr_changed == 'true'}} | ||
uses: ./.github/workflows/docker-test.yml | ||
with: | ||
directory: base_ottr | ||
tag: jhudsl/course_template | ||
dockerhubpush: true | ||
secrets: | ||
GH_PAT: ${{ secrets.GH_PAT }} | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
build-ottrpal: | ||
name: Build ottrpal image | ||
needs: dockerfiles-changed | ||
if: ${{needs.dockerfiles-changed.outputs.ottrpal_changed == 'true'}} | ||
uses: ./.github/workflows/docker-test.yml | ||
with: | ||
directory: ottrpal | ||
tag: jhudsl/ottrpal | ||
dockerhubpush: true | ||
secrets: | ||
GH_PAT: ${{ secrets.GH_PAT }} | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
build-bioconductor: | ||
name: Build bioconductor image | ||
needs: dockerfiles-changed | ||
if: ${{needs.dockerfiles-changed.outputs.bioconductor_changed == 'true'}} | ||
uses: ./.github/workflows/docker-test.yml | ||
with: | ||
directory: bioconductor | ||
tag: jhudsl/ottr_bioconductor | ||
dockerhubpush: true | ||
secrets: | ||
GH_PAT: ${{ secrets.GH_PAT }} | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
build-quarto: | ||
name: Build quarto image | ||
needs: dockerfiles-changed | ||
if: ${{needs.dockerfiles-changed.outputs.quarto_changed == 'true'}} | ||
uses: ./.github/workflows/docker-test.yml | ||
with: | ||
directory: ottr_quarto | ||
tag: jhudsl/ottr_quarto | ||
dockerhubpush: true | ||
secrets: | ||
GH_PAT: ${{ secrets.GH_PAT }} | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }} | ||
directory: ${{ matrix.config.dir }} | ||
tag: ${{ matrix.config.name }} | ||
dockerhubpush: false | ||
token: ${{ secrets.GH_PAT }} | ||
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} |
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,4 +1,4 @@ | ||
# Candace Savonen March 2024 | ||
# Candace Savonen Jan 2025 | ||
|
||
name: Pull Request | ||
|
||
|
@@ -8,110 +8,44 @@ on: | |
|
||
jobs: | ||
|
||
dockerfiles-changed: | ||
name: Detect changed Dockerfiles | ||
dockerfile-check: | ||
name: Test changed Dockerfile - ${{ matrix.config.dir }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
config: | ||
- {dir: base_ottr, name: 'jhudsl/base_ottr'} | ||
- {dir: bioconductor, name: 'jhudsl/ottr_bioconductor'} | ||
- {dir: ottrpal, name: 'jhudsl/ottrpal'} | ||
- {dir: ottr_anvil_poll, name: 'jhudsl/anvil-poll-2024'} | ||
- {dir: ottr_datatables, name: 'jhudsl/ottr_datatables'} | ||
- {dir: ottr_website, name: 'jhudsl/ottr_website'} | ||
# NEW IMAGES HERE: # | ||
####### - {dir: directory_path, name: 'name its called on dockerhub'} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Get specific changed files | ||
id: base_ottr | ||
id: image_name | ||
uses: tj-actions/[email protected] | ||
with: | ||
files: base_ottr/* | ||
|
||
- name: Get specific changed files | ||
id: ottrpal | ||
uses: tj-actions/[email protected] | ||
with: | ||
files: ottrpal/* | ||
|
||
- name: Get specific changed files | ||
id: bioconductor | ||
uses: tj-actions/[email protected] | ||
with: | ||
files: bioconductor/* | ||
|
||
- name: Get specific changed files | ||
id: python | ||
uses: tj-actions/[email protected] | ||
with: | ||
files: ottr_python/* | ||
|
||
- name: Get specific changed files | ||
id: quarto | ||
uses: tj-actions/[email protected] | ||
with: | ||
files: ottr_quarto/* | ||
files: ${{ matrix.config.dir }}/* | ||
|
||
- run: | | ||
echo ${{steps.base_ottr.outputs.any_changed}} | ||
echo ${{steps.ottrpal.outputs.any_changed}} | ||
echo ${{steps.bioconductor.outputs.any_changed}} | ||
echo ${{steps.python.outputs.any_changed}} | ||
echo ${{steps.quarto.outputs.any_changed}} | ||
outputs: | ||
base_ottr_changed: ${{steps.base_ottr.outputs.any_changed}} | ||
ottrpal_changed: ${{steps.ottrpal.outputs.any_changed}} | ||
bioconductor_changed: ${{steps.bioconductor.outputs.any_changed}} | ||
python_changed: ${{steps.python.outputs.any_changed}} | ||
quarto_changed: ${{steps.quarto.outputs.any_changed}} | ||
echo ${{ steps.image_name.outputs.any_changed }} | ||
echo ${{ matrix.config.dir }} | ||
build-base: | ||
name: Build base ottr image | ||
needs: dockerfiles-changed | ||
if: ${{needs.dockerfiles-changed.outputs.base_ottr_changed == 'true'}} | ||
uses: ./.github/workflows/docker-test.yml | ||
with: | ||
directory: base_ottr | ||
tag: jhudsl/base_ottr | ||
secrets: | ||
GH_PAT: ${{ secrets.GH_PAT }} | ||
|
||
build-ottrpal: | ||
name: Build ottrpal image | ||
needs: dockerfiles-changed | ||
if: ${{needs.dockerfiles-changed.outputs.ottrpal_changed == 'true'}} | ||
uses: ./.github/workflows/docker-test.yml | ||
with: | ||
directory: ottrpal | ||
tag: jhudsl/ottrpal | ||
secrets: | ||
GH_PAT: ${{ secrets.GH_PAT }} | ||
|
||
build-bioconductor: | ||
name: Build bioconductor image | ||
needs: dockerfiles-changed | ||
if: ${{needs.dockerfiles-changed.outputs.bioconductor_changed == 'true'}} | ||
uses: ./.github/workflows/docker-test.yml | ||
with: | ||
directory: bioconductor | ||
tag: jhudsl/ottr_bioconductor | ||
secrets: | ||
GH_PAT: ${{ secrets.GH_PAT }} | ||
|
||
build-python: | ||
name: Build python image | ||
needs: dockerfiles-changed | ||
if: ${{needs.dockerfiles-changed.outputs.python_changed == 'true'}} | ||
uses: ./.github/workflows/docker-test.yml | ||
with: | ||
directory: ottr_python | ||
tag: jhudsl/ottr_python | ||
secrets: | ||
GH_PAT: ${{ secrets.GH_PAT }} | ||
|
||
build-quarto: | ||
name: Build quarto ottr image | ||
needs: dockerfiles-changed | ||
if: ${{needs.dockerfiles-changed.outputs.quarto_changed == 'true'}} | ||
uses: ./.github/workflows/docker-test.yml | ||
with: | ||
directory: ottr_quarto | ||
tag: jhudsl/ottr_quarto | ||
secrets: | ||
GH_PAT: ${{ secrets.GH_PAT }} | ||
- name: Docker build | ||
if: ${{ steps.image_name.outputs.any_changed == 'true'}} | ||
uses: ./.github/workflows/ | ||
with: | ||
directory: ${{ matrix.config.dir }} | ||
tag: ${{ matrix.config.name }} | ||
dockerhubpush: false | ||
token: ${{ secrets.GH_PAT }} | ||
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} |
Oops, something went wrong.