chore: release common 0.2.0 (#69) #7
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 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 |