From 5a4f13e24eb3ea272d3cddc5446b53700d647c85 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Mon, 8 Jul 2024 10:11:26 -0500 Subject: [PATCH] Publish Maven artifacts to dogtagpki/repo Previously JSS's Maven artifacts were published to GitHub Packages which is a private repository so it's difficult to use. To resolve the problem, the pom.xml has been modified to publish the artifacts to a publicly accessible dogtagpki/repo instead. --- .github/workflows/publish.yml | 23 +++++++++++----- pom.xml | 51 ++++++++++++++++++++++------------- 2 files changed, 49 insertions(+), 25 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2dc4506f4..cb0b3d472 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -14,6 +14,11 @@ jobs: name: Publishing Maven artifacts runs-on: ubuntu-latest steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get -y install xmlstarlet + - name: Clone repository uses: actions/checkout@v4 @@ -23,15 +28,21 @@ jobs: java-version: '17' distribution: 'adopt' - - name: Check settings.xml + - name: Configure settings.xml run: | + xmlstarlet edit --inplace \ + -u "/_:settings/_:servers/_:server[_:id='github']/_:password" \ + -v "$REPO_TOKEN" \ + ~/.m2/settings.xml cat ~/.m2/settings.xml + env: + REPO_TOKEN: ${{ secrets.REPO_TOKEN }} - - name: Update pom.xml + - name: Configure pom.xml run: | - sed -i \ - -e "s/OWNER/$NAMESPACE/g" \ - -e "s/REPOSITORY/jss/g" \ + xmlstarlet edit --inplace \ + -u "/_:project/_:build/_:plugins/_:plugin[_:artifactId='site-maven-plugin']/_:configuration/_:repositoryOwner" \ + -v "$NAMESPACE" \ pom.xml cat pom.xml @@ -43,8 +54,6 @@ jobs: --update-snapshots \ -pl '!native,!symkey' \ deploy - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} wait-for-images: if: vars.REGISTRY != '' diff --git a/pom.xml b/pom.xml index eda7f2e88..b3551cd25 100644 --- a/pom.xml +++ b/pom.xml @@ -15,6 +15,7 @@ - - UTF-8 + github @@ -58,25 +59,39 @@ maven-surefire-plugin 3.1.2 + + org.apache.maven.plugins + maven-deploy-plugin + 2.8.2 + + local::default::file://${project.build.directory}/repo + + + + com.github.github + site-maven-plugin + 0.12 + + Deploy ${project.groupId}:${project.artifactId}:${project.version} + ${project.build.directory}/repo + + **/* + + OWNER + repo + refs/heads/maven + true + + + + + site + + deploy + + + - - - github - https://maven.pkg.github.com/OWNER/* - - true - - - - - - - github - GitHub Packages - https://maven.pkg.github.com/OWNER/REPOSITORY - - -