-
Notifications
You must be signed in to change notification settings - Fork 7
38 lines (33 loc) · 1.19 KB
/
docker.yml
File metadata and controls
38 lines (33 loc) · 1.19 KB
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
name: Build and publish Docker image
on:
push:
branches:
- develop
- master
- release-2.0.8-docker
env:
IMAGE_NAME: ${{ github.repository }}/latest
jobs:
build_and_publish:
runs-on: ubuntu-18.04
steps:
- run: env
- uses: actions/checkout@v1
- uses: actions/cache@v1
with:
path: /var/lib/docker
key: ${{ runner.os }}-docker-${{ hashFiles('Dockerfile') }}
restore-keys: |
${{ runner.os }}-docker-
- name: Build and tag the Docker image
run: docker build . --file Dockerfile --tag docker.pkg.github.com/${IMAGE_NAME}:${GITHUB_REF##*/}
- name: Tag (latest) the Docker image
run: docker tag docker.pkg.github.com/${IMAGE_NAME}:${GITHUB_REF##*/} docker.pkg.github.com/${IMAGE_NAME}:latest
if: github.ref == 'refs/heads/master'
- name: Login to registry
run: docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} docker.pkg.github.com
- name: Publish image
run: docker push docker.pkg.github.com/${IMAGE_NAME}:${GITHUB_REF##*/}
- name: Publish image (latest)
run: docker push docker.pkg.github.com/${IMAGE_NAME}:latest
if: github.ref == 'refs/heads/master'