-
Notifications
You must be signed in to change notification settings - Fork 3
47 lines (40 loc) · 1.28 KB
/
docker.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
---
name: Docker
on:
push:
branches:
- master
paths:
- "**"
release:
types: [created, edited, published]
env:
ORG: opendatacube
IMAGE: wps
jobs:
docker:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
steps:
- name: Login to DockerHub
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Export Secrets to enviroment
run: |
echo "${{ secrets.DockerPassword }}" | docker login -u "${{ secrets.DockerUser }}" --password-stdin
# Tag image if this is a tagged build
# if not use a pseudo tag based on current tag,
# number of commits since last tag and git hash
- name: Push to DockerHub (master branch or tagged release only)
if: github.ref == 'refs/heads/master' || github.event_name == 'release'
run: |
# figure out extra tag
git fetch --prune --unshallow 2> /dev/null || true
TAG=$(git describe --tags)
# build local docker image
docker build -t ${ORG}/${IMAGE}:latest .
# tag and push images
docker tag ${ORG}/${IMAGE}:latest ${ORG}/${IMAGE}:${TAG}
docker push ${ORG}/${IMAGE}:latest
docker push ${ORG}/${IMAGE}:${TAG}