Skip to content

Commit

Permalink
Publish Maven artifacts to dogtagpki/repo
Browse files Browse the repository at this point in the history
Previously PKI's Maven artifacts were published to GitHub
Packages which is a private repository.

To make it easier to use, the pom.xml has been modified to
publish the artifacts to a publicly accessible dogtagpki/repo
instead.
  • Loading branch information
edewata committed Jul 8, 2024
1 parent c4ee740 commit a8216ea
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 15 deletions.
18 changes: 13 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -23,11 +28,16 @@ jobs:
java-version: '17'
distribution: 'adopt'

- name: Check settings.xml
- name: Configure settings.xml
run: |
cat ~/.m2/settings.xml
xmlstarlet edit --inplace \
-u "/_:settings/_:servers/_:server/_:password" \
-v "$REPO_TOKEN" \
~/.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" \
Expand All @@ -43,8 +53,6 @@ jobs:
--update-snapshots \
-DskipTests \
deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
wait-for-images:
if: vars.REGISTRY != ''
Expand Down
22 changes: 22 additions & 0 deletions pki.spec
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,8 @@ pkgs=base\
%if %{with meta}
echo "Removing RPM deps from %{buildroot}%{_datadir}/maven-metadata/pki.xml"
xmlstarlet edit --inplace \
-d "//_:dependency[_:org.apache.maven.plugins:maven-deploy-plugin']" \
-d "//_:dependency[_:com.github.github:site-maven-plugin']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.core']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.module']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.jaxrs']" \
Expand All @@ -1226,6 +1228,8 @@ ls -l %{buildroot}%{_datadir}/pki/lib

echo "Removing RPM deps from %{buildroot}%{_datadir}/maven-metadata/pki-pki-java.xml"
xmlstarlet edit --inplace \
-d "//_:dependency[_:org.apache.maven.plugins:maven-deploy-plugin']" \
-d "//_:dependency[_:com.github.github:site-maven-plugin']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.core']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.module']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.jaxrs']" \
Expand All @@ -1236,6 +1240,8 @@ xmlstarlet edit --inplace \

echo "Removing RPM deps from %{buildroot}%{_datadir}/maven-metadata/pki-pki-tools.xml"
xmlstarlet edit --inplace \
-d "//_:dependency[_:org.apache.maven.plugins:maven-deploy-plugin']" \
-d "//_:dependency[_:com.github.github:site-maven-plugin']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.core']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.module']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.jaxrs']" \
Expand All @@ -1252,6 +1258,8 @@ ls -l %{buildroot}%{_datadir}/pki/server/common/lib

echo "Removing RPM deps from %{buildroot}%{_datadir}/maven-metadata/pki-pki-server.xml"
xmlstarlet edit --inplace \
-d "//_:dependency[_:org.apache.maven.plugins:maven-deploy-plugin']" \
-d "//_:dependency[_:com.github.github:site-maven-plugin']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.core']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.module']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.jaxrs']" \
Expand All @@ -1264,6 +1272,8 @@ xmlstarlet edit --inplace \
%if %{with ca}
echo "Removing RPM deps from %{buildroot}%{_datadir}/maven-metadata/pki-pki-ca.xml"
xmlstarlet edit --inplace \
-d "//_:dependency[_:org.apache.maven.plugins:maven-deploy-plugin']" \
-d "//_:dependency[_:com.github.github:site-maven-plugin']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.core']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.module']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.jaxrs']" \
Expand All @@ -1276,6 +1286,8 @@ xmlstarlet edit --inplace \
%if %{with kra}
echo "Removing RPM deps from %{buildroot}%{_datadir}/maven-metadata/pki-pki-kra.xml"
xmlstarlet edit --inplace \
-d "//_:dependency[_:org.apache.maven.plugins:maven-deploy-plugin']" \
-d "//_:dependency[_:com.github.github:site-maven-plugin']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.core']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.module']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.jaxrs']" \
Expand All @@ -1288,6 +1300,8 @@ xmlstarlet edit --inplace \
%if %{with ocsp}
echo "Removing RPM deps from %{buildroot}%{_datadir}/maven-metadata/pki-pki-ocsp.xml"
xmlstarlet edit --inplace \
-d "//_:dependency[_:org.apache.maven.plugins:maven-deploy-plugin']" \
-d "//_:dependency[_:com.github.github:site-maven-plugin']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.core']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.module']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.jaxrs']" \
Expand All @@ -1300,6 +1314,8 @@ xmlstarlet edit --inplace \
%if %{with tks}
echo "Removing RPM deps from %{buildroot}%{_datadir}/maven-metadata/pki-pki-tks.xml"
xmlstarlet edit --inplace \
-d "//_:dependency[_:org.apache.maven.plugins:maven-deploy-plugin']" \
-d "//_:dependency[_:com.github.github:site-maven-plugin']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.core']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.module']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.jaxrs']" \
Expand All @@ -1312,6 +1328,8 @@ xmlstarlet edit --inplace \
%if %{with tps}
echo "Removing RPM deps from %{buildroot}%{_datadir}/maven-metadata/pki-pki-tps.xml"
xmlstarlet edit --inplace \
-d "//_:dependency[_:org.apache.maven.plugins:maven-deploy-plugin']" \
-d "//_:dependency[_:com.github.github:site-maven-plugin']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.core']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.module']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.jaxrs']" \
Expand All @@ -1324,6 +1342,8 @@ xmlstarlet edit --inplace \
%if %{with acme}
echo "Removing RPM deps from %{buildroot}%{_datadir}/maven-metadata/pki-pki-acme.xml"
xmlstarlet edit --inplace \
-d "//_:dependency[_:org.apache.maven.plugins:maven-deploy-plugin']" \
-d "//_:dependency[_:com.github.github:site-maven-plugin']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.core']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.module']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.jaxrs']" \
Expand All @@ -1336,6 +1356,8 @@ xmlstarlet edit --inplace \
%if %{with est}
echo "Removing RPM deps from %{buildroot}%{_datadir}/maven-metadata/pki-pki-est.xml"
xmlstarlet edit --inplace \
-d "//_:dependency[_:org.apache.maven.plugins:maven-deploy-plugin']" \
-d "//_:dependency[_:com.github.github:site-maven-plugin']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.core']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.module']" \
-d "//_:dependency[_:groupId='com.fasterxml.jackson.jaxrs']" \
Expand Down
45 changes: 35 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<github.global.server>github</github.global.server>
</properties>

<modules>
Expand Down Expand Up @@ -69,25 +70,49 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<altDeploymentRepository>local::default::file://${project.build.directory}/repo</altDeploymentRepository>
</configuration>
</plugin>
<plugin>
<groupId>com.github.github</groupId>
<artifactId>site-maven-plugin</artifactId>
<version>0.12</version>
<configuration>
<message>Deploy ${project.groupId}:${project.artifactId}:${project.version}</message>
<outputDirectory>${project.build.directory}/repo</outputDirectory>
<includes>
<include>**/*</include>
</includes>
<repositoryOwner>OWNER</repositoryOwner>
<repositoryName>repo</repositoryName>
<branch>refs/heads/maven</branch>
<merge>true</merge>
</configuration>
<executions>
<execution>
<goals>
<goal>site</goal>
</goals>
<phase>deploy</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/OWNER/*</url>
<id>dogtagpki</id>
<url>https://raw.githubusercontent.com/OWNER/repo/maven</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/OWNER/REPOSITORY</url>
</repository>
</distributionManagement>

</project>

0 comments on commit a8216ea

Please sign in to comment.