-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (50 loc) · 1.57 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Deploy RADICAL-Tutorials container
# https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows
on:
# https://docs.github.com/en/rest/repos/repos#create-a-repository-dispatch-event
repository_dispatch:
types: [ deploy-on-demand ]
workflow_call:
secrets:
DOCKERHUB_USERNAME:
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
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
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=${{ env.TUTORIAL_NAME }}
platforms: linux/amd64,linux/arm64
push: true
tags: radicalcybertools/tutorials:${{ env.TUTORIAL_NAME }}