Skip to content

Commit 641ea2f

Browse files
authored
Merge pull request #20 from smeyer198/deployment
Add deployment parts for Maven Central
2 parents f386d1f + ad911ca commit 641ea2f

File tree

3 files changed

+150
-15
lines changed

3 files changed

+150
-15
lines changed

.github/workflows/deploy.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Deploy PathExpression
2+
3+
on: [workflow_dispatch]
4+
5+
jobs:
6+
deployment:
7+
runs-on: ubuntu-latest
8+
name: PathExpression deployment
9+
steps:
10+
- name: Checkout source code
11+
uses: actions/checkout@v3
12+
# Sets up Java version
13+
- name: Set up Java
14+
uses: actions/setup-java@v3
15+
with:
16+
distribution: 'adopt'
17+
java-package: 'jdk'
18+
java-version: '11'
19+
server-id: 'ossrh' # must match the serverId configured for the nexus-staging-maven-plugin
20+
server-username: OSSRH_USERNAME # Env var that holds your OSSRH user name
21+
server-password: OSSRH_PASSWORD # Env var that holds your OSSRH user pw
22+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Substituted with the value stored in the referenced secret
23+
gpg-passphrase: SIGN_KEY_PASS # Env var that holds the key's passphrase
24+
# Sets up Maven version
25+
- name: Set up Maven
26+
uses: stCarolas/setup-maven@v4.5
27+
with:
28+
maven-version: 3.6.3
29+
- name: Build & Deploy PathExpression
30+
run: mvn -B -U clean deploy -Pdeployment
31+
env:
32+
SIGN_KEY_PASS: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
33+
OSSRH_USERNAME: ${{ secrets.SONATYPE_USER }}
34+
OSSRH_PASSWORD: ${{ secrets.SONATYPE_PW }}

.github/workflows/release.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Publish package to GitHub Packages
2+
on:
3+
release:
4+
types: [created]
5+
jobs:
6+
publish:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
contents: read
10+
packages: write
11+
steps:
12+
- uses: actions/checkout@v4
13+
- uses: actions/setup-java@v3
14+
with:
15+
java-version: '11'
16+
distribution: 'temurin'
17+
- name: Publish package
18+
run: mvn --batch-mode deploy
19+
env:
20+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pom.xml

Lines changed: 96 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,92 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
32
<modelVersion>4.0.0</modelVersion>
43
<groupId>de.fraunhofer.iem</groupId>
5-
<artifactId>PathExpression</artifactId>
6-
<version>1.0.0-SNAPSHOT</version>
4+
<artifactId>pathexpression</artifactId>
5+
<version>1.0.1</version>
6+
7+
<licenses>
8+
<license>
9+
<name>Eclipse Public License - v2.0</name>
10+
<url>https://www.eclipse.org/legal/epl-2.0/</url>
11+
</license>
12+
</licenses>
13+
14+
<scm>
15+
<connection>scm:git:${project.scm.url}</connection>
16+
<developerConnection>scm:git:${project.scm.url}</developerConnection>
17+
<url>git@github.com:johspaeth/PathExpression.git</url>
18+
<tag>${project.version}</tag>
19+
</scm>
20+
<description>Implementation of an algorithm by Tarjan that efficiently computes path expressions based on a labeled graph</description>
21+
<url>https://github.com/johspaeth/PathExpression</url>
22+
23+
<developers>
24+
<developer>
25+
<name>Johannes Spaeth</name>
26+
<email>johannes.spaeth@codeshield.de</email>
27+
<organization>CodeShield GmbH</organization>
28+
<organizationUrl>https://codeshield.de/</organizationUrl>
29+
</developer>
30+
</developers>
31+
32+
<profiles>
33+
<!-- This profile is used to avoid running the deployment in non-deployment
34+
contexts because they require specific keys from the Github remote. Include
35+
this profile by setting the -Pdeployment flag. -->
36+
<profile>
37+
<id>deployment</id>
38+
<build>
39+
<plugins>
40+
<plugin>
41+
<groupId>org.sonatype.plugins</groupId>
42+
<artifactId>nexus-staging-maven-plugin</artifactId>
43+
<version>1.6.13</version>
44+
<extensions>true</extensions>
45+
<configuration>
46+
<serverId>ossrh</serverId>
47+
<nexusUrl>https://s01.oss.sonatype.org</nexusUrl>
48+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
49+
</configuration>
50+
</plugin>
51+
<plugin>
52+
<groupId>org.apache.maven.plugins</groupId>
53+
<artifactId>maven-source-plugin</artifactId>
54+
<version>3.2.1</version>
55+
<executions>
56+
<execution>
57+
<id>attach-source</id>
58+
<goals>
59+
<goal>jar</goal>
60+
</goals>
61+
</execution>
62+
</executions>
63+
</plugin>
64+
<plugin>
65+
<groupId>org.apache.maven.plugins</groupId>
66+
<artifactId>maven-gpg-plugin</artifactId>
67+
<version>3.0.1</version>
68+
<executions>
69+
<execution>
70+
<id>sign-artifacts</id>
71+
<phase>verify</phase>
72+
<goals>
73+
<goal>sign</goal>
74+
</goals>
75+
<configuration>
76+
<gpgArguments>
77+
<arg>--pinentry-mode</arg>
78+
<arg>loopback</arg>
79+
</gpgArguments>
80+
</configuration>
81+
</execution>
82+
</executions>
83+
</plugin>
84+
</plugins>
85+
</build>
86+
</profile>
87+
</profiles>
88+
89+
790
<build>
891
<plugins>
992
<plugin>
@@ -20,17 +103,12 @@
20103
</plugin>
21104
</plugins>
22105
</build>
23-
<scm>
24-
<connection>scm:git:${project.scm.url}</connection>
25-
<developerConnection>scm:git:${project.scm.url}</developerConnection>
26-
<url>git@github.com:johspaeth/PathExpression.git</url>
27-
<tag>${project.version}</tag>
28-
</scm>
106+
29107
<dependencies>
30108
<dependency>
31109
<groupId>com.google.guava</groupId>
32110
<artifactId>guava</artifactId>
33-
<version>29.0-jre</version>
111+
<version>32.0.0-jre</version>
34112
</dependency>
35113
<dependency>
36114
<groupId>junit</groupId>
@@ -41,15 +119,18 @@
41119
<dependency>
42120
<groupId>org.apache.logging.log4j</groupId>
43121
<artifactId>log4j-core</artifactId>
44-
<version>2.13.2</version>
122+
<version>2.17.1</version>
45123
</dependency>
46124
</dependencies>
47125

48126
<distributionManagement>
127+
<snapshotRepository>
128+
<id>ossrh</id>
129+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots/</url>
130+
</snapshotRepository>
49131
<repository>
50-
<id>github</id>
51-
<name>GitHub Packages</name>
52-
<url>https://maven.pkg.github.com/johspaeth/PathExpression</url>
132+
<id>ossrh</id>
133+
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
53134
</repository>
54135
</distributionManagement>
55136
</project>

0 commit comments

Comments
 (0)