-
Notifications
You must be signed in to change notification settings - Fork 4
103 lines (103 loc) · 3.72 KB
/
java.publish.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
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
#
# Copyright (c) 2021-2023 - for information on the respective copyright owner
# see the NOTICE file and/or the repository https://github.com/carbynestack/amphora.
#
# SPDX-License-Identifier: Apache-2.0
#
name: Publish and Release Java
on:
push:
tags:
- "parent-v[0-9]+.[0-9]+.[0-9]+"
- "common-v[0-9]+.[0-9]+.[0-9]+"
- "java-client-v[0-9]+.[0-9]+.[0-9]+"
- "service-v[0-9]+.[0-9]+.[0-9]+"
env:
REGISTRY: ghcr.io
jobs:
prepare:
runs-on: ubuntu-22.04
outputs:
MODULE: "${{ steps.module.outputs.identifier }}"
VERSION: "${{ steps.release.outputs.version }}"
steps:
- name: Get Release Package Name
id: package
run: |
echo ::set-output name=name::$(echo ${GITHUB_REF_NAME} | sed -E 's/-v[0-9]+\.[0-9]+\.[0-9]+//')
- name: Get Module Identifier
id: module
run: |
echo ::set-output name=identifier::${GITHUB_REPOSITORY#*/}-${{ steps.package.outputs.name }}
- name: Checkout repository
uses: actions/checkout@v2
- name: Get Release Version
run: echo ::set-output name=version::$(${GITHUB_REF#refs/*/${{ steps.package.outputs.name }}-v})
id: release
publish:
runs-on: ubuntu-22.04
needs: [prepare]
env:
MODULE: "${{ needs.prepare.outputs.MODULE }}"
VERSION: "${{ needs.prepare.outputs.VERSION }}"
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Retrieve license obligation resources
id: license-obligations
working-directory: "${{ env.MODULE }}"
run: |
cd 3RD-PARTY-LICENSES
FILES=$(find . -maxdepth 1 -type d -not -path .)
if [ -n "$FILES" ]
then
echo "${FILES}" | zip -r@ 3rd-party-copyrights
fi
find . -iname origin.src | \
awk '{ \
split($0,b,"/"); \
system("xargs < " $0 " curl --create-dirs -Lo ./sources/" b[2] ".zip " $2)}' && \
find -regex './sources$' | awk '{system("zip -jr ./3rd-party-sources.zip " $0)}'
mkdir -p ../license-obligations
ARCHIVES=$(find . -regex "^./3rd-party-.*.zip$")
OBLIGATIONS_FOUND="false"
if [ -n "$ARCHIVES" ]
then
mv $(echo "${ARCHIVES}") ../license-obligations/
OBLIGATIONS_FOUND="true"
fi
echo "OBLIGATIONS_FOUND=${OBLIGATIONS_FOUND}" >> $GITHUB_OUTPUT
- name: Update Release with license obligations resources
uses: ncipollo/release-action@v1
if: steps.license-obligations.outputs.OBLIGATIONS_FOUND == 'true'
with:
allowUpdates: true
artifacts: ${{ env.MODULE }}/license-obligations/*
artifactErrorsFailBuild: true
makeLatest: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
- name: Setup java
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: 'maven'
- name: Setting up Github Package Repository as Maven Repository
uses: s4u/[email protected]
with:
githubServer: false
servers: |
[{
"id": "github",
"username": "${{ secrets.GHPR_USERNAME }}",
"password": "${{ secrets.GHPR_TOKEN }}"
}]
- name: Log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Publish version to GitHub Packages and Docker Image on GHCR
run: ./mvnw -pl ${{ env.MODULE }} deploy -Ddockerfile.skip=false -Dskip.tests --batch-mode --no-transfer-progress