-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (62 loc) · 1.95 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
name: Publish Docker Image
on:
# generate image whenever there is a push to the listed branches
push:
branches:
- master
- hugo-style
# generate images for releases, using the tag name
# the newest one will be latest as well
release:
types: [published]
jobs:
push_to_registry:
# only generate images when in the named repo
# (to avoid running the action in forks)
if: github.repository == 'scilifelabdatacentre/dsw-appendix'
name: Publish Docker Image
runs-on: ubuntu-latest
# Cancel earlier job if there is a new one for the same branch/release
concurrency:
group: ${{ github.ref }}-docker-build
cancel-in-progress: true
# Define the images/tags to build; will run in parallell
strategy:
matrix:
include:
- dockerfile: Dockerfile
images: |
ghcr.io/scilifelabdatacentre/dsw-appendix
permissions:
contents: read
packages: write
steps:
- name: Check out the repo
uses: actions/checkout@v3
# only needed when publishing to Github (ghcr.io)
- name: Log in to Github Container Repository
uses: docker/login-action@v2
with:
registry: ghcr.io
# will run as the user who triggered the action, using its token
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker Meta
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ matrix.images }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Build and Publish
uses: docker/build-push-action@v3
with:
file: ${{ matrix.dockerfile }}
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}