Skip to content

Fix test

Fix test #39

Workflow file for this run

name: Build and publish release
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build:
name: Maven Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: main
- name: Set up JDK for compilation
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
- name: Build weasis-dicom-tools
run: mvn -B clean install -f main
- name: Extract Maven project version
run: |
cd main
MVN_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)
echo "LIB_VERSION=${MVN_VERSION}" >> $GITHUB_ENV
id: project
- name: Checkout mvn-repo repository
uses: actions/checkout@v3
with:
repository: nroduit/mvn-repo
path: mvn-repo
token: ${{ secrets.API_TOKEN_GITHUB }}
- name: Install xmlstarlet
run: sudo apt-get install xmlstarlet
- name: Commit the maven packages
run: |
cd mvn-repo
REPO=$(pwd)
PKGFOLDER="org/weasis/weasis-dicom-tools"
TAG_VERSION=${{ env.LIB_VERSION }}
F_META="maven-metadata.xml"
cd ~/.m2/repository/${PKGFOLDER}
find . -name "*.jar" -o -name "*.pom" | cpio -updm ${REPO}/${PKGFOLDER}
cd ${REPO}/${PKGFOLDER}
xmlstarlet ed --inplace -u "//metadata/version" -v ${TAG_VERSION} -u "//metadata/versioning/release" -v ${TAG_VERSION} \
-u "//metadata/versioning/lastUpdated" -v $(date "+%Y%m%d%H%M%S") ${F_META}
IFS=$'\n'
versions=$(xmlstarlet sel -t -m "//metadata/versioning/versions" -v version ${F_META})
if printf '%s\n' "${versions[@]}" | grep -q -P "^${TAG_VERSION}$"; then
:
else
xmlstarlet ed --inplace -s "//metadata/versioning/versions" -t elem -n "version" -v ${TAG_VERSION} ${F_META}
fi
paths=($(find . -name "*.jar" -o -name "*.pom" -o -name "${F_META}"))
for file in ${paths[@]}; do
$(sha1sum "${file}" | awk '{printf $1}' > "${file}".sha1)
$(md5sum "${file}" | awk '{printf $1}' > "${file}".md5)
done
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -m "Add weasis-dicom-tools release"
git push