-
Notifications
You must be signed in to change notification settings - Fork 1
37 lines (36 loc) · 1.07 KB
/
publish-to-dockerhub.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
name: Publish image to Dockerhub
on:
push:
branches:
- master
- develop
- main
workflow_dispatch:
inputs:
branch_name:
description: Branch to build from
default: develop
required: true
jobs:
push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
if: github.event_name == 'workflow_dispatch'
with:
ref: '${{ github.event.inputs.branch_name }}'
- uses: actions/checkout@v2
if: github.event_name == 'push'
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Push image
env:
DOCKERHUB_ACCOUNT: ${{ secrets.DOCKERHUB_ACCOUNT }}
DOCKERHUB_REPO: ${{ secrets.DOCKERHUB_REPO }}
run: |
export COUNTRY_CONFIG_VERSION=`git rev-parse --short=7 HEAD`
echo "Publishing a Docker image with a tag $COUNTRY_CONFIG_VERSION"
bash build-and-push.sh && unset COUNTRY_CONFIG_VERSION