-
Notifications
You must be signed in to change notification settings - Fork 3
40 lines (36 loc) · 1.53 KB
/
push_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
38
39
40
name: Docker push
# This builds the docker image and pushes it to DockerHub
# Runs on qbic-pipelines repo releases and push event to 'dev' branch (PR merges)
on:
push:
branches:
- dev
release:
types: [published]
jobs:
push_dockerhub:
name: Push new Docker image to Docker Hub
runs-on: ubuntu-latest
# Only run for the qbicpipelines repo, for releases and merged PRs
if: ${{ github.repository == 'qbic-pipelines/vcreport' }}
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_PASS: ${{ secrets.DOCKERHUB_PASS }}
steps:
- name: Check out pipeline code
uses: actions/checkout@v2
- name: Build new docker image
run: docker build --no-cache . -t qbicpipelines/vcreport:latest
- name: Push Docker image to DockerHub (dev)
if: ${{ github.event_name == 'push' }}
run: |
echo "$DOCKERHUB_PASS" | docker login --username "$DOCKERHUB_USERNAME" --password-stdin
docker tag qbicpipelines/vcreport:latest qbicpipelines/vcreport:dev
docker push qbicpipelines/vcreport:dev
- name: Push Docker image to DockerHub (release)
if: ${{ github.event_name == 'release' }}
run: |
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
docker push qbicpipelines/vcreport:latest
docker tag qbicpipelines/vcreport:latest qbicpipelines/vcreport:${{ github.event.release.tag_name }}
docker push qbicpipelines/vcreport:${{ github.event.release.tag_name }}