diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..62ac400 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,51 @@ +name: Release to Maven Central + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 8 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '8' + + - name: Import GPG key + env: + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + run: | + echo "$GPG_PRIVATE_KEY" | gpg --batch --import + + - name: Configure Maven settings + env: + CENTRAL_TOKEN_USERNAME: ${{ secrets.CENTRAL_TOKEN_USERNAME }} + CENTRAL_TOKEN_PASSWORD: ${{ secrets.CENTRAL_TOKEN_PASSWORD }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + run: | + mkdir -p ~/.m2 + cat > ~/.m2/settings.xml < + + + central + ${CENTRAL_TOKEN_USERNAME} + ${CENTRAL_TOKEN_PASSWORD} + + + D7771F55ED62AAC7162CFDE833B20E4440CDF36D + ${GPG_PASSPHRASE} + + + + EOF + + - name: Publish to Maven Central + run: mvn --batch-mode clean deploy diff --git a/README.md b/README.md index 03f6cce..2b47af2 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ If you are using Maven, add the following to your `pom.xml` file: org.hsluv hsluv - 1.0 + 1.0.1 # Usage @@ -73,37 +73,31 @@ var color = android.graphics.Color.rgb(r, g, b); Docs: -- https://central.sonatype.org/publish/publish-maven/ +- https://central.sonatype.org/publish/publish-portal-maven/ - https://central.sonatype.org/publish/requirements/gpg/ +- https://central.sonatype.org/publish/generate-portal-token/ -Set `~/m2/settings.xml`: +Generate a Portal token at https://central.sonatype.com, then set `~/.m2/settings.xml`: ```xml - ossrh - hsluv - REDACTEDREDACTEDREDACTED + central + + + + + D7771F55ED62AAC7162CFDE833B20E4440CDF36D + - - - ossrh - - true - - - REDACTEDREDACTEDREDACTED - - - ``` Then run: ```bash -mvn versions:set -DnewVersion=0.3 # bump version -mvn clean deploy -P release +mvn versions:set -DnewVersion=1.0.1 # bump version +mvn clean deploy ``` diff --git a/pom.xml b/pom.xml index f1c00da..9e10e2a 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.hsluv hsluv jar - 1.0 + 1.0.1 hsluv Human-friendly HSL @@ -57,25 +57,17 @@ - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - - - org.sonatype.plugins - nexus-staging-maven-plugin - 1.6.13 + org.sonatype.central + central-publishing-maven-plugin + 0.11.0 true - ossrh - https://oss.sonatype.org/ - true + central + true + published @@ -116,8 +108,8 @@ sign - EBFD22439E5C59D664D0CFC750617B51F61187C2 - EBFD22439E5C59D664D0CFC750617B51F61187C2 + D7771F55ED62AAC7162CFDE833B20E4440CDF36D + D7771F55ED62AAC7162CFDE833B20E4440CDF36D --pinentry-mode loopback