-
Notifications
You must be signed in to change notification settings - Fork 15
40 lines (34 loc) · 970 Bytes
/
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
name: Build and publish Docker image
on:
push:
branches:
- "master"
tags:
- "v*"
env:
DOCKER_IMAGE_BASENAME: ghcr.io/osm-without-borders/cosmogony
DOCKER_BUILDKIT: 1
jobs:
build_docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Login to container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get image name
run: |
VERSION=${GITHUB_REF#refs/*/}
if [ "$VERSION" == "master" ]; then
IMAGE_TAG=latest
else
IMAGE_TAG=$VERSION
fi
echo "DOCKER_IMAGE=$DOCKER_IMAGE_BASENAME:$IMAGE_TAG" >> $GITHUB_ENV
- run: docker build --label "org.label-schema.vcs-ref=$GITHUB_SHA" -t $DOCKER_IMAGE .
- run: docker push $DOCKER_IMAGE