Skip to content

Commit

Permalink
Disable publishing to Maven Central
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus-87 committed Feb 27, 2024
1 parent 4f31dab commit dd607e6
Showing 1 changed file with 58 additions and 57 deletions.
115 changes: 58 additions & 57 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,60 +54,61 @@ jobs:
**/target
- name: Publish code coverage reports
uses: codecov/codecov-action@v3
publish:
if: (github.event_name == 'push' && (contains(github.ref, 'main') || startsWith(github.ref, 'release/'))) || github.event_name == 'release'
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up cache
uses: actions/cache@v3
env:
cache-name: cache-maven-artifacts
with:
key: metasvc-cache-java-17-${{ github.run_id }}
path: |
~/.m2/repository
**/target
- name: Install XML utils
run: sudo apt update && sudo apt install libxml2-utils
- name: Extract project version
run: echo "PROJECT_VERSION=$(xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' pom.xml)" >> $GITHUB_ENV
# Publish snapshot
- name: Set up JDK 17 for publishing a snapshot
if: github.event_name == 'push' && endswith(env.PROJECT_VERSION, 'SNAPSHOT')
uses: actions/setup-java@v3
with:
check-latest: true
distribution: temurin
java-version: 17
server-id: ossrh-snapshots
server-password: MAVEN_PASSWORD
server-username: MAVEN_USERNAME
- name: Publish snapshot to the Maven Central Repository
if: github.event_name == 'push' && endswith(env.PROJECT_VERSION, 'SNAPSHOT')
run: mvn -B deploy -DskipTests -Pmaven-central
env:
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
# Publish release
- name: Set up JDK 17 for publishing a release
if: github.event_name == 'release' && !endswith(env.PROJECT_VERSION, 'SNAPSHOT')
uses: actions/setup-java@v3
with:
check-latest: true
distribution: temurin
gpg-passphrase: MAVEN_GPG_PASSPHRASE
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
java-version: 17
server-id: ossrh
server-password: MAVEN_PASSWORD
server-username: MAVEN_USERNAME
- name: Publish release to the Maven Central Repository
if: github.event_name == 'release' && !endswith(env.PROJECT_VERSION, 'SNAPSHOT')
run: mvn -B deploy -DskipTests -Pmaven-central,sign
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
# Does not work at the moment because of the changed groupId
# publish:
# if: (github.event_name == 'push' && (contains(github.ref, 'main') || startsWith(github.ref, 'release/'))) || github.event_name == 'release'
# needs: build
# runs-on: ubuntu-latest
# steps:
# - name: Check out repository
# uses: actions/checkout@v3
# - name: Set up cache
# uses: actions/cache@v3
# env:
# cache-name: cache-maven-artifacts
# with:
# key: metasvc-cache-java-17-${{ github.run_id }}
# path: |
# ~/.m2/repository
# **/target
# - name: Install XML utils
# run: sudo apt update && sudo apt install libxml2-utils
# - name: Extract project version
# run: echo "PROJECT_VERSION=$(xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' pom.xml)" >> $GITHUB_ENV
# # Publish snapshot
# - name: Set up JDK 17 for publishing a snapshot
# if: github.event_name == 'push' && endswith(env.PROJECT_VERSION, 'SNAPSHOT')
# uses: actions/setup-java@v3
# with:
# check-latest: true
# distribution: temurin
# java-version: 17
# server-id: ossrh-snapshots
# server-password: MAVEN_PASSWORD
# server-username: MAVEN_USERNAME
# - name: Publish snapshot to the Maven Central Repository
# if: github.event_name == 'push' && endswith(env.PROJECT_VERSION, 'SNAPSHOT')
# run: mvn -B deploy -DskipTests -Pmaven-central
# env:
# MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
# MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
# # Publish release
# - name: Set up JDK 17 for publishing a release
# if: github.event_name == 'release' && !endswith(env.PROJECT_VERSION, 'SNAPSHOT')
# uses: actions/setup-java@v3
# with:
# check-latest: true
# distribution: temurin
# gpg-passphrase: MAVEN_GPG_PASSPHRASE
# gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
# java-version: 17
# server-id: ossrh
# server-password: MAVEN_PASSWORD
# server-username: MAVEN_USERNAME
# - name: Publish release to the Maven Central Repository
# if: github.event_name == 'release' && !endswith(env.PROJECT_VERSION, 'SNAPSHOT')
# run: mvn -B deploy -DskipTests -Pmaven-central,sign
# env:
# MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
# MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
# MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}

0 comments on commit dd607e6

Please sign in to comment.