From 51e99f690460418c7375a962086d5e3073a61440 Mon Sep 17 00:00:00 2001 From: Mikhail Titov Date: Thu, 26 Dec 2024 16:36:45 -0500 Subject: [PATCH] extended `deploy` workflow with configurable parameter `tutorial` --- .github/workflows/ci.yml | 2 +- .github/workflows/deploy.yml | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86892de..71ce4a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: docker load --input /tmp/${{ env.TUTORIAL_IMAGE_NAME }}.tar docker image ls -a - name: Run tutorials - timeout-minutes: 15 + timeout-minutes: 20 run: | docker run ${{ env.TUTORIAL_TAG }} bash -c "\ jupyter nbconvert --clear-output --inplace ${{ env.TARGET_PATH }} && \ diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 478dae5..bea7e49 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,13 +10,17 @@ on: required: true DOCKERHUB_TOKEN: required: true + inputs: + tutorial: + description: 'Tutorial name and tag' + default: 'latest' + type: string + required: false jobs: deploy: name: Push docker image runs-on: ubuntu-latest - env: - TUTORIAL_TAG: radicalcybertools/tutorials:latest steps: - uses: actions/checkout@v4 with: @@ -27,13 +31,22 @@ jobs: password: ${{ secrets.DOCKERHUB_TOKEN }} - uses: docker/setup-qemu-action@v3 - uses: docker/setup-buildx-action@v3 + - name: set env + run: |- + echo "TUTORIAL_NAME=$( + if [[ ${{ github.event_name }} == repository_dispatch ]]; then + echo ${{ github.event.client_payload.tutorial || 'latest' }} + elif [[ ${{ github.event_name }} == workflow_call ]]; then + echo ${{ inputs.tutorial }} + fi + )" >> $GITHUB_ENV - uses: docker/build-push-action@v6 with: context: ./src/ file: ./docker/Dockerfile build-args: | - TUTORIAL_NAME=latest + TUTORIAL_NAME=${{ env.TUTORIAL_NAME }} platforms: linux/amd64,linux/arm64 push: true - tags: ${{ env.TUTORIAL_TAG }} + tags: radicalcybertools/tutorials:${{ env.TUTORIAL_NAME }}