-
Notifications
You must be signed in to change notification settings - Fork 8
executable file
·55 lines (54 loc) · 1.63 KB
/
docker-base.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
52
53
54
55
name: 'Build docker image: base'
on:
push:
branches:
- master
tags:
- '*.*.*'
- 'v*.*.*'
- '*.*.*-*'
- 'v*.*.*-*'
paths:
- 'dockers/base.Dockerfile'
pull_request:
paths:
- 'dockers/base.Dockerfile'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 10
- name: Build the Docker image
run: |
make build_Base
- name: login to DockerHub
run: |
echo ${DOCKERHUB_PASS} | docker login --username ${DOCKERHUB_USER} --password-stdin
env:
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
DOCKERHUB_PASS: ${{ secrets.DOCKERHUB_PASS }}
- name: push to DockerHub (master)
if: github.ref == 'refs/heads/master'
run: |
imagename=`make name_base`
docker tag ${imagename} ${imagename}:nightly
docker push ${imagename}:nightly
- name: push to DockerHub (pull request)
if: github.event_name == 'pull_request'
run: |
imagename=`make name_base`
pr_num=`cat $GITHUB_EVENT_PATH | jq -r ".number"`
docker tag ${imagename} ${imagename}:pr-${pr_num}
docker push ${imagename}:pr-${pr_num}
- name: push to DockerHub (tags)
if: startsWith( github.ref, 'refs/tags/')
run: |
imagename=`make name_base`
docker push ${imagename}:latest
tag_name=`echo $GITHUB_REF | sed -e 's:^refs/tags/::'`
docker tag ${imagename} ${imagename}:${tag_name}
docker push ${imagename}:${tag_name}
docker tag ${imagename} ${imagename}:nightly
docker push ${imagename}:nightly