-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (71 loc) · 2.44 KB
/
publish.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
name: Publish
on:
push:
branches: [main]
tags: ["v*"]
concurrency:
group: publish-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
uses: ./.github/workflows/lint.yml
docker-build:
uses: ./.github/workflows/docker-build.yml
publish-docker-images:
needs:
- lint
- docker-build
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up context
uses: FranzDiebold/github-env-vars-action@v2.8.0
- name: Extract metadata (tags, labels) for Docker
id: docker_metadata
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKER_HUB_USERNAME }}/eimis-keycloak
tags: |
type=raw,enable=${{ !endsWith(github.ref, github.event.repository.default_branch) }},value=${{ env.CI_ACTION_REF_NAME_SLUG }}
type=raw,enable=${{ endsWith(github.ref, github.event.repository.default_branch) }},value=nightly
type=raw,enable=${{ startsWith(github.ref, 'refs/tags/v') }},value=latest
type=semver,pattern={{version}}
labels: |
org.opencontainers.image.vendor=EIMIS
- name: Login to Docker registry
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and publish image(s)
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.docker_metadata.outputs.tags }}
labels: ${{ steps.docker_metadata.outputs.labels }}
dockerhub-description:
needs:
- publish-docker-images
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Find change in readme file
id: readme-change
uses: tj-actions/changed-files@v41
with:
files: |
README.md
- name: Docker Hub Description
if: steps.readme-change.outputs.any_changed == 'true'
uses: peter-evans/dockerhub-description@v4
with:
username: ${{ vars.DOCKER_HUB_USERNAME }}
short-description: Docker image for https://github.com/${{ github.repository }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
repository: ${{ vars.DOCKER_HUB_USERNAME }}/eimis-keycloak
readme-filepath: README.md