-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (63 loc) · 2.16 KB
/
image-release.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Docker image releaser
on:
push:
branches:
- main
jobs:
generate-matrix:
name: Generate matrix of updated images
runs-on: ubuntu-latest
outputs:
matrix-docker: ${{ steps.neo-image.outputs.matrix }}
steps:
- name: Generate matrix | Infrastructure
id: neo-image
uses: hellofresh/action-changed-files@v2
with:
pattern: docker-images/(?P<image>(?!.releaserc)[^/]+)
publish:
runs-on: ubuntu-22.04
needs: [generate-matrix]
strategy:
max-parallel: 1
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix-docker) }}
if: ${{ fromJson(needs.generate-matrix.outputs.matrix-docker).include[0] }}
steps:
- uses: actions/checkout@v3
- name: Move config to current package
run: |
mv docker-images/.releaserc docker-images/${{ matrix.image}}/
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
id: semver
with:
semantic_version: 19.0.5
extra_plugins: |
@semantic-release/[email protected]
@semantic-release/git
working_directory: docker-images/${{ matrix.image }}
env:
IMAGE_NAME: ${{ matrix.image }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to the Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, label) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ghcr.io/${{ github.repository }}/${{ matrix.image }}
flavor: ${{ inputs.docker-metadata-flavor }}
- name: Build an push image
uses: docker/build-push-action@v3
with:
context: docker-images/${{ matrix.image }}
push: true
tags: |
ghcr.io/${{ github.repository }}/${{ matrix.image }}:v${{ steps.semver.outputs.new_release_version }}
${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}