Skip to content

Commit 82c8f48

Browse files
authored
Merge pull request #806 from johnjaylward/deploymentPipeline
Add new deployment pipeline
2 parents 996d3a5 + 006b29b commit 82c8f48

2 files changed

Lines changed: 62 additions & 6 deletions

File tree

.github/workflows/deployment.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# For more information see:
2+
# * https://docs.github.com/en/actions/learn-github-actions
3+
# * https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
4+
# * https://github.com/actions/setup-java/blob/v3.13.0/docs/advanced-usage.md#Publishing-using-Apache-Maven
5+
#
6+
7+
name: Deployment workflow
8+
9+
on:
10+
release:
11+
types: [published]
12+
13+
jobs:
14+
publish:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up Java for publishing to Maven Central Repository
22+
uses: actions/setup-java@v3
23+
with:
24+
# Use lowest supported LTS Java version
25+
java-version: '8'
26+
distribution: 'temurin'
27+
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
28+
server-username: MAVEN_USERNAME # env variable for username in deploy
29+
server-password: MAVEN_PASSWORD # env variable for token in deploy
30+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
31+
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
32+
33+
- name: Publish to the Maven Central Repository
34+
run: mvn --batch-mode deploy
35+
env:
36+
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
37+
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
38+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
39+
# - name: Set up Java for publishing to GitHub Packages
40+
# uses: actions/setup-java@v3
41+
# with:
42+
# # Use lowest supported LTS Java version
43+
# java-version: '8'
44+
# distribution: 'temurin'
45+
# - name: Publish to GitHub Packages
46+
# run: mvn --batch-mode deploy
47+
# env:
48+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pom.xml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@
2121
</description>
2222
<url>https://github.com/douglascrockford/JSON-java</url>
2323

24-
<parent>
25-
<groupId>org.sonatype.oss</groupId>
26-
<artifactId>oss-parent</artifactId>
27-
<version>9</version>
28-
</parent>
29-
3024
<scm>
3125
<url>https://github.com/douglascrockford/JSON-java.git</url>
3226
<connection>scm:git:git://github.com/douglascrockford/JSON-java.git</connection>
@@ -52,6 +46,20 @@
5246
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
5347
</properties>
5448

49+
50+
<distributionManagement>
51+
<repository>
52+
<id>ossrh</id>
53+
<name>Central Repository OSSRH</name>
54+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
55+
</repository>
56+
<snapshotRepository>
57+
<id>ossrh</id>
58+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
59+
</snapshotRepository>
60+
</distributionManagement>
61+
62+
5563
<dependencies>
5664
<dependency>
5765
<groupId>junit</groupId>

0 commit comments

Comments
 (0)