-
Notifications
You must be signed in to change notification settings - Fork 2
72 lines (71 loc) · 2.22 KB
/
deploy-docker.yml
File metadata and controls
72 lines (71 loc) · 2.22 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Reusable workflow to push Docker image to DockerHub
# Can be called from other workflows with parameters
on:
workflow_call:
inputs:
cli:
type: string
required: true
repository:
type: string
required: false
branch:
type: string
required: false
build_folder:
type: string
required: false
default: "build-folder"
org:
type: string
required: true
secrets:
DOCKER_HUB_USER:
required: false
DOCKER_HUB_PASSWORD:
required: false
ZETTA_DOCKER_HUB_USER:
required: false
ZETTA_DOCKER_HUB_PASSWORD:
required: false
jobs:
deploy-docker-hub:
name: Push Docker image
runs-on: ${{ vars.UBUNTU_VERSION }}
steps:
# Optionally checkout a specific repository and branch if provided
- name: "Checkout optional repo"
uses: actions/checkout@v4
if: inputs.repository != '' && inputs.branch != ''
with:
fetch-depth: 0
fetch-tags: true
repository: ${{ inputs.repository }}
ref: ${{ inputs.branch }}
# Download build artifacts
- uses: actions/download-artifact@v4
with:
name: ${{ inputs.build_folder }}
path: build
# Make all shell scripts in build folder executable
- name: Chmod
run: "find build -regex '.*sh' | while read file ; do chmod u+x $file ; done"
# Log in to DockerHub using Zetta credentials if org is zettagenomics
- name: Docker Login Zetta
if: inputs.org == 'zettagenomics'
uses: docker/login-action@v3
with:
username: ${{ secrets.ZETTA_DOCKER_HUB_USER }}
password: ${{ secrets.ZETTA_DOCKER_HUB_PASSWORD }}
logout: true
# Log in to DockerHub using OpenCB credentials if org is opencb
- name: Docker Login OpenCB
if: inputs.org == 'opencb'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
logout: true
# Deploy the Docker image to DockerHub
- name: Deploy in Docker Hub
run: ${{ inputs.cli }} --org ${{ inputs.org }}