-
Notifications
You must be signed in to change notification settings - Fork 24
109 lines (101 loc) · 3.28 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Summary:
#
# job docker-main-latest:
# * for push to main branch, update "latest" tag
#
# job docker-sha-release-latest:
# * for release, update "latest" tag
# * git ref tag, eg. "sha-ad132f5"
# * release tag major.minor.path, e.g. "1.2.3" (alpine g80)
# * release tag major.minor, e.g. "1.2" (alpine g78)
name: Docker
on:
push:
branches: [main]
tags: ['*.*.*']
paths-ignore: ['docs/**']
release:
types: [published]
env:
# Additionally mentioned in docker-sha-release-latest
# as use of variable fails there
DOCKERHUB_REPOSITORY: mundialis/actinia-core
jobs:
# only run for push to main branch
# take care of latest tag
docker-main-latest:
name: build and push latest for main branch
if: startsWith(github.ref, 'refs/heads/main') && github.repository_owner == 'actinia-org'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- id: meta
name: Create tag name
run: |
tag=${DOCKERHUB_REPOSITORY}:latest
echo "tags=$tag" >> "$GITHUB_OUTPUT"
- name: log
run: echo ${{ steps.meta.outputs.tags }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
push: true
pull: true
context: .
tags: ${{ steps.meta.outputs.tags }}
file: docker/actinia-core-alpine/Dockerfile
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
# run always
# On push to branch, take care of sha-ref tag
# On release, take care of latest and release tags
docker-sha-release-latest:
name: build and push release or latest
if: startsWith(github.ref, 'refs/tags/') && github.repository_owner == 'actinia-org'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Create image and tag names
id: meta
uses: docker/metadata-action@v5
with:
# images: ${DOCKERHUB_REPOSITORY}
images: mundialis/actinia-core
tags: |
type=ref,event=tag
type=semver,pattern={{major}}.{{minor}}
type=sha
flavor: |
latest=auto
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v6
with:
push: true
pull: true
context: .
tags: ${{ steps.meta.outputs.tags }}
file: docker/actinia-core-alpine/Dockerfile
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}