Skip to content

Commit

Permalink
chore: added workflow to publish release
Browse files Browse the repository at this point in the history
  • Loading branch information
bekoenig committed Mar 15, 2024
1 parent 1a810f3 commit 3930a0e
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 2 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Build and Publish Release to OSSRH

on:
workflow_dispatch:
inputs:
releaseVersion:
description: "Version to use when preparing a release."
required: true
default: "X.Y.Z"
developmentVersion:
description: "Version to use for new local working copy."
required: true
default: "X.Y.Z-SNAPSHOT"

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
gpg-passphrase: OSSRH_GPG_SECRET_KEY_PASSWORD
- name: Configure Git user
run: |
git config user.email "[email protected]"
git config user.name "GitHub Actions"
- name: Build, Release and Publish to OSSRH
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
OSSRH_GPG_SECRET_KEY_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
run: |
mvn -DreleaseVersion=${inputs.releaseVersion} -DdevelopmentVersion=${inputs.developmentVersion} --no-transfer-progress --batch-mode release:prepare release:perform -Dpublish=true
- name: Push changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
- name: Push tags
uses: ad-m/[email protected]
with:
branch: ${{ github.ref }}
github_token: ${{ secrets.GITHUB_TOKEN }}
tags: true
11 changes: 9 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
</properties>

<scm>
<connection>scm:git:git://github.com/bekoenig/getdown.git</connection>
<connection>scm:git:git@github.com:bekoenig/getdown.git</connection>
<developerConnection>scm:git:[email protected]:bekoenig/getdown.git</developerConnection>
<url>https://github.com/bekoenig/getdown</url>
<tag>HEAD</tag>
</scm>

<modules>
Expand All @@ -56,6 +57,10 @@
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>

<dependencyManagement>
Expand Down Expand Up @@ -197,9 +202,10 @@
<artifactId>maven-release-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<localCheckout>true</localCheckout>
<pushChanges>false</pushChanges>
<autoVersionSubmodules>true</autoVersionSubmodules>
<tagNameFormat>@{project.version}</tagNameFormat>
<goals>deploy</goals>
</configuration>
</plugin>

Expand All @@ -211,6 +217,7 @@
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
Expand Down

0 comments on commit 3930a0e

Please sign in to comment.