This repository has been archived by the owner on Feb 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
103 lines (99 loc) · 3.9 KB
/
upstream-dgca-verifier-service.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
# Sourced from https://github.com/eu-digital-green-certificates/dgc-gateway/blob/a57d6b61ca69f435814edf68615a22c09e88e34a/.github/workflows/ci-main.yml
# Copyright (C) 2021 T-Systems International GmbH and all other contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "Upstream: dgca-verifier-service"
on:
push:
branches:
- main
paths:
- 'upstream/dgca-verifier-service'
- 'upstream/patches/dgca-verifier-service/**'
- '.github/workflows/upstream-dgca-verifier-service.yml'
jobs:
build-docker:
runs-on: ubuntu-20.04
steps:
- uses: actions/setup-java@v2
with:
java-version: 11
distribution: adopt
- uses: actions/checkout@v2
with:
submodules: true
fetch-depth: 0
- name: patch
working-directory: ./upstream/dgca-verifier-service
run: >-
for f in ../patches/dgca-verifier-service/*.patch; do
patch -p1 < $f;
done;
- uses: actions/cache@v2
with:
path: |
~/.m2/repository
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
- name: azure-version
run: >-
AZURE_SHA=$(git rev-parse --short HEAD);
AZURE_REV=$(git rev-list --tags --max-count=1);
AZURE_TAG=$(git describe --tags ${AZURE_REV} 2> /dev/null || echo 0.0.0);
AZURE_VERSION=${AZURE_TAG}-${AZURE_SHA};
echo "AZURE_VERSION=${AZURE_VERSION}" >> ${GITHUB_ENV};
- name: upstream-version
working-directory: ./upstream/dgca-verifier-service
run: >-
APP_SHA=$(git rev-parse --short HEAD);
APP_REV=$(git rev-list --tags --max-count=1);
APP_TAG=$(git describe --tags ${APP_REV} 2> /dev/null || echo 0.0.0);
APP_VERSION=${APP_TAG}-${APP_SHA}-azure-${AZURE_VERSION};
echo "APP_VERSION=${APP_VERSION}" >> ${GITHUB_ENV};
- name: mvn
working-directory: ./upstream/dgca-verifier-service
run: >-
mvn versions:set
--batch-mode
--file ./pom.xml
--settings ./settings.xml
--define newVersion="${APP_VERSION}";
mvn clean install -P azure
--batch-mode
--file ./pom.xml
--settings ./settings.xml
--define app.packages.username="${APP_PACKAGES_USERNAME}"
--define app.packages.password="${APP_PACKAGES_PASSWORD}";
env:
APP_PACKAGES_USERNAME: ${{ github.actor }}
APP_PACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
# GHCR Requires the image name to be lowercase, while
# `github.repository` will contain `Azure/...`.
- name: lowercase-repository
run: >-
GITHUB_REPO=${{ github.repository }};
echo "GITHUB_REPO_LWR=${GITHUB_REPO,,}" >> ${GITHUB_ENV};
- name: docker
working-directory: ./upstream/dgca-verifier-service
run: >-
echo "${APP_PACKAGES_PASSWORD}" |
docker login "${APP_PACKAGES_URL}"
--username "${APP_PACKAGES_USERNAME}"
--password-stdin;
docker build .
--file ./Dockerfile
--tag "${APP_PACKAGES_URL}:${APP_VERSION}";
docker push "${APP_PACKAGES_URL}:${APP_VERSION}";
env:
APP_PACKAGES_URL: ghcr.io/${{ env.GITHUB_REPO_LWR }}/dgca-verifier-service
APP_PACKAGES_USERNAME: ${{ github.actor }}
APP_PACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }}