Skip to content

Commit

Permalink
ci: env variables as inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
demartis committed May 10, 2023
1 parent 054f009 commit 48f8338
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,14 @@ jobs:
needs: [ Prepare ]
uses: ./.github/workflows/sub_description.yaml
secrets: inherit
with:
DOCKERHUB_REPO: {{ env.DOCKERHUB_REPO}}

R2020a:
needs: [ Prepare ]
uses: ./.github/workflows/sub_release.yaml
with:
DOCKERHUB_REPO: {{ env.DOCKERHUB_REPO}}
DOCKERHUB_TAG: R2020a
DOCKER_CONTEXT: R2020a
is_latest: true
6 changes: 5 additions & 1 deletion .github/workflows/sub_description.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ name: Description

on:
workflow_call:
inputs:
DOCKERHUB_REPO:
required: true
type: string
secrets:
DOCKERHUB_USERNAME:
required: true
Expand All @@ -25,4 +29,4 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
repository: ${{ env.DOCKERHUB_REPO }}
repository: ${{ inputs.DOCKERHUB_REPO }}
11 changes: 7 additions & 4 deletions .github/workflows/sub_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ name: Release
on:
workflow_call:
inputs:
DOCKERHUB_REPO:
required: true
type: string
DOCKERHUB_TAG:
required: true
type: string
Expand All @@ -31,17 +34,17 @@ jobs:
with:
context: ./${{ inputs.DOCKER_CONTEXT }}
tags: |
${{ env.DOCKERHUB_REPO }}:${{ inputs.DOCKERHUB_TAG }}
${{ inputs.is_latest && format('{0}:latest', env.DOCKERHUB_REPO) || '' }}
${{ inputs.DOCKERHUB_REPO }}:${{ inputs.DOCKERHUB_TAG }}
${{ inputs.is_latest && format('{0}:latest', inputs.DOCKERHUB_REPO) || '' }}
# outputs: type=docker,dest=/tmp/myimage.tar
-
name: Inspect
run: |
docker image inspect ${{ env.DOCKERHUB_REPO }}:${{ inputs.DOCKERHUB_TAG }}
docker image inspect ${{ inputs.DOCKERHUB_REPO }}:${{ inputs.DOCKERHUB_TAG }}
-
name: Test
run: |
docker run --rm ${{ env.DOCKERHUB_REPO }}:${{ inputs.DOCKERHUB_TAG }} echo "TODO: ADD MCR TEST"
docker run --rm ${{ inputs.DOCKERHUB_REPO }}:${{ inputs.DOCKERHUB_TAG }} echo "TODO: ADD MCR TEST"
# -
Expand Down

0 comments on commit 48f8338

Please sign in to comment.