-
Notifications
You must be signed in to change notification settings - Fork 2
47 lines (45 loc) · 1.49 KB
/
docker-image.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
44
45
46
47
name: Build and push docker image
on:
push:
branches:
- master
- testing
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
distro: ["", ".ubuntu"]
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
yousong/dconf
ghcr.io/yousong/dconf
# generate Docker tags based on the following events/attributes
tags: |
type=raw,value={{date 'YYYYMMDD'}}${{ matrix.distro }},enable=${{ github.ref == 'refs/heads/master' }}
type=raw,value=latest${{ matrix.distro }},enable=${{ github.ref == 'refs/heads/master' }}
type=raw,value=testing${{ matrix.distro }},enable=${{ github.ref == 'refs/heads/testing' }}
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to ghcr.io
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
file: Dockerfile${{ matrix.distro }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}