Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Deploy a branch
name: Release new version

on:
workflow_dispatch:
Expand All @@ -8,14 +8,19 @@ on:
default: false
type: boolean

skip-tests:
description: "Skip unit and integration tests"
default: false
type: boolean

version:
description: "Override deployment version"
default: ""
type: string

jobs:
maven-central:
name: Deploy to Maven Central
release:
name: Release
environment:
name: maven-central
url: https://repo1.maven.org/maven2/io/github/ascopes/jct/java-compiler-testing/
Expand All @@ -35,14 +40,14 @@ jobs:
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 23
server-id: ossrh
server-username: OSSRH_USERNAME
server-password: OSSRH_TOKEN
java-version: 24
server-id: central
server-username: CENTRAL_USERNAME
server-password: CENTRAL_TOKEN
gpg-passphrase: GPG_PASSPHRASE
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}

- name: Deploy to staging
- name: Create Maven Central Release
shell: bash
run: |-
git config user.name '${{ github.actor }}'
Expand All @@ -58,30 +63,26 @@ jobs:
./mvnw -B -e \
-Preleases \
-DdryRun='${{ inputs.dry-run }}' \
-Dinvoker.skip='${{ inputs.skip-tests }}' \
-Dpassword='${{ secrets.GITHUB_TOKEN }}' \
-DreleaseVersion="${release_version}" \
-DsignTag=false \
-DskipTests='${{ inputs.skip-tests }}' \
-Dtag="v${release_version}" \
clean verify release:prepare release:perform

echo "Created staging release for ${group_id}/${artifact_id}/${release_version}"
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
CENTRAL_USERNAME: ${{ secrets.CENTRAL_USERNAME }}
CENTRAL_TOKEN: ${{ secrets.CENTRAL_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Abort and rollback staging release
- name: Revert Maven Central Release
if: ${{ failure() }}
run: |-
./mvnw -B -e \
-Dpassword='${{ secrets.GITHUB_TOKEN }}' \
-DreleaseVersion="${release_version}" \
-Dtag="v${release_version}" \
release:rollback
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: Create GitHub Release
if: ${{ ! inputs.dry-run }}
Expand Down
2 changes: 1 addition & 1 deletion java-compiler-testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<groupId>io.github.ascopes.jct</groupId>
<artifactId>java-compiler-testing-parent</artifactId>
<version>5.0.2-SNAPSHOT</version>
<version>5.0.2-rc2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
28 changes: 11 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

<groupId>io.github.ascopes.jct</groupId>
<artifactId>java-compiler-testing-parent</artifactId>
<version>5.0.2-SNAPSHOT</version>
<version>5.0.2-rc2-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Java Compiler Testing parent project</name>
Expand Down Expand Up @@ -57,15 +57,10 @@

<distributionManagement>
<repository>
<id>ossrh</id>
<name>Maven Central Releases</name>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<id>central</id>
<name>Maven Central</name>
<url>https://central.sonatype.com</url>
</repository>
<snapshotRepository>
<id>ossrh</id>
<name>Maven Central Snapshots</name>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>

<issueManagement>
Expand Down Expand Up @@ -104,6 +99,7 @@
<slf4j.version>2.0.17</slf4j.version>

<!-- Plugins -->
<central-publishing-maven-plugin.version>0.7.0</central-publishing-maven-plugin.version>
<jacoco-maven-plugin.version>0.8.13</jacoco-maven-plugin.version>
<license-maven-plugin.version>5.0.0</license-maven-plugin.version>
<maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
Expand All @@ -119,7 +115,6 @@
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
<maven-source-plugin.version>3.3.1</maven-source-plugin.version>
<maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version>
<nexus-staging-maven-plugin.version>1.7.0</nexus-staging-maven-plugin.version>

<!-- Plugin dependencies -->
<checkstyle.version>10.23.0</checkstyle.version>
Expand Down Expand Up @@ -684,15 +679,14 @@
and then triggering a "closure" operation that will promote it to
the public Maven repository.
-->
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${nexus-staging-maven-plugin.version}</version>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>${central-publishing-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<serverId>ossrh</serverId>
<stagingProgressTimeoutMinutes>10</stagingProgressTimeoutMinutes>
<autoPublish>true</autoPublish>
<publishingServerId>central</publishingServerId>
<waitUntil>published</waitUntil>
</configuration>
</plugin>
</plugins>
Expand Down