forked from mviewer/mviewer
-
Notifications
You must be signed in to change notification settings - Fork 1
43 lines (39 loc) · 1.34 KB
/
build-on-push.yaml
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
name: "Building & push docker image for master and develop branch"
on:
push:
branches:
- master
- develop
jobs:
docker-build:
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: "Checking out the repository"
uses: actions/checkout@v2
- name: "Calculating the docker image tag"
if: github.repository == 'mviewer/mviewer'
id: version
run: |
if [[ $GITHUB_REF == 'refs/heads/master' ]]; then
echo ::set-output name=VERSION::stable
elif [[ $GITHUB_REF == 'refs/heads/develop' ]]; then
echo ::set-output name=VERSION::latest
else
echo "This action only works with master or develop branch"
exit 1
fi
- name: "build the container"
if: github.repository == 'mviewer/mviewer'
run: |
docker build -t mviewer/mviewer:${{ steps.version.outputs.VERSION }} .
- name: "Log onto docker hub"
if: github.repository == 'mviewer/mviewer'
uses: azure/docker-login@v1
with:
username: '${{ secrets.DOCKER_HUB_USERNAME }}'
password: '${{ secrets.DOCKER_HUB_PASSWORD }}'
- name: "push the container"
if: github.repository == 'mviewer/mviewer'
run: |
docker push mviewer/mviewer:${{ steps.version.outputs.VERSION }}