-
Notifications
You must be signed in to change notification settings - Fork 16
97 lines (89 loc) · 3.51 KB
/
build-and-publish-connector-images.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
name: EDC Docker Images
on:
push:
branches: [ main ]
release:
types: [ published ]
pull_request:
branches: [ main ]
env:
REGISTRY: ghcr.io
IMAGE_NAME_BASE: ${{ github.repository_owner }}
IMAGE_NAME: edc
jobs:
build-and-push-image:
runs-on: ubuntu-latest
strategy:
matrix:
imageVariants: [
{
"imageName": "edc-dev",
"title": "sovity Dev EDC Connector",
"description": "Extended EDC Connector built by sovity. This dev version contains no persistence or auth and can be used to quickly start a locally running EDC + EDC UI.",
"buildArgs": "-Pdmgmt-api-key"
},
{
"imageName": "edc-ce",
"title": "sovity Community Edition EDC Connector",
"description": "EDC Connector built by sovity. Contains sovity's Community Edition EDC extensions and requires dataspace credentials to join an existing dataspace.",
"buildArgs": "-Pfs-vault -Pdmgmt-api-key -Ppostgres-flyway -Poauth2"
},
{
"imageName": "edc-ce-mds",
"title": "MDS Community Edition EDC Connector",
"description": "EDC Connector built by sovity and configured for compatibility with the Mobility Data Space (MDS). This EDC requires dataspace credentials, an IDS broker and an IDS Clearing House.",
"buildArgs": "-Pfs-vault -Pdmgmt-api-key -Ppostgres-flyway -Poauth2 -Pmds"
}
]
timeout-minutes: 30
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Store last commit info and build date
id: last-commit-information
run: |
echo "Saving local commit details."
echo "LAST_COMMIT_INFO<<EOF" >> $GITHUB_ENV
export LAST_COMMIT_INFO=$(git log -1)
echo "$LAST_COMMIT_INFO" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "BUILD_DATE=$(date --utc +%FT%TZ)" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_BASE }}/${{ matrix.imageVariants.imageName }}
labels: |
org.opencontainers.image.title=${{ matrix.imageVariants.title }}
org.opencontainers.image.description=${{ matrix.imageVariants.description }}
tags: |
type=schedule
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,event=branch
type=ref,event=pr
type=sha
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=release,enable=${{ startsWith(github.ref, 'refs/tags/') }}
- name: Build and push EDC image
uses: docker/build-push-action@v4
with:
file: connector/Dockerfile
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BUILD_ARGS=${{ matrix.imageVariants.buildArgs }}
EDC_LAST_COMMIT_INFO_ARG="${{ env.LAST_COMMIT_INFO }}"
EDC_BUILD_DATE_ARG="${{ env.BUILD_DATE }}"