-
Notifications
You must be signed in to change notification settings - Fork 15
57 lines (48 loc) · 1.49 KB
/
docker-github.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
name: Docker - GitHub Registry
on:
push:
branches:
- master
tags:
- '*'
paths-ignore:
- '**.md'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v3
# this is a little bit of "dark magick"...
# Github Registry seems to hate Usernames Containing UpperCase...
#
# this metadata action normalizes the image tags into something useable.
# I'm not sure it's the _best_ set of Docker Tags to use.
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
ghcr.io/${{ github.repository_owner }}/${{ github.repository }}${{ env.TAG }}
tags: |
type=raw,value=3.0.${{ github.run_number }},priority=1000
type=ref,event=branch
type=sha
type=raw,value=latest
- name: Log in to ghcr
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- if: startsWith(github.ref, 'refs/heads/master')
run: echo "TAG=latest" >> $GITHUB_ENV
- if: startsWith(github.ref, 'refs/tags')
run: echo "TAG=$(git describe --tags)" >> $GITHUB_ENV
- name: Build & Push
uses: docker/build-push-action@v4
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}