Skip to content

Commit

Permalink
Add GPG key installation to publishing action
Browse files Browse the repository at this point in the history
Signed-off-by: Nullicorn <bennullicorn@gmail.com>
  • Loading branch information
TheNullicorn committed Jan 30, 2022
1 parent 4df006d commit e018592
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Publish package to the Maven Central Repository and GitHub Packages
name: Publish package to the Maven Central Repository
on:
release:
types: [created]
types: [ created ]
jobs:
publish:
runs-on: ubuntu-latest
permissions:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
packages: write
steps:
- uses: actions/checkout@v2
- name: Set up Java for publishing to Maven Central Repository
Expand All @@ -18,8 +18,17 @@ jobs:
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD

- name: Install GPG secret key
id: install-secret-key
run: cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import

- name: Publish to the Maven Central Repository
run: mvn --batch-mode deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
run: mvn \
--no-transfer-progress \
--batch-mode \
-Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} \
clean deploy
14 changes: 7 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@
<url>https://github.com/TheNullicorn/Nedit/tree/master</url>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>

<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
Expand All @@ -61,13 +68,6 @@
</repository>
</distributionManagement>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>

<build>
<plugins>
<plugin>
Expand Down

0 comments on commit e018592

Please sign in to comment.