Skip to content

v1.0.0-RC.1

v1.0.0-RC.1 #3

Workflow file for this run

name: Publish package to GitHub Packages
on:
release:
types: [ published ]
jobs:
build:
name: Build
runs-on: ubuntu-latest
services:
mongo:
image: mongo:4.4
ports:
- 27017:27017
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'adopt'
- uses: cardinalby/git-get-release-action@v1
id: getEnvRelease
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get Project Version from pom.xml
uses: entimaniac/[email protected]
id: getVersion
# - name: Check Enviroment release
# if: ${{ !((steps.getEnvRelease.outputs.prerelease && contains(steps.getVersion.outputs.version, '-SNAPSHOT')) || (!steps.getEnvRelease.outputs.prerelease && !contains(steps.getVersion.outputs.version, '-SNAPSHOT'))) }}
# run: exit 1
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build
run: mvn clean verify
test:
name: Test
needs: build
runs-on: ubuntu-latest
timeout-minutes: 200
services:
mongo:
image: mongo:4.4
ports:
- 27017:27017
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'adopt'
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build
run: mvn clean package install -DskipTests=true
- name: Build, test
timeout-minutes: 180
run: mvn -B test
publish-OSSRH:
runs-on: ubuntu-latest
name: Publish to Maven Central
needs: test
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- id: install-secret-key
name: Install gpg secret key
run: |
cat <(echo -e "${{ secrets.OSSRH_GPG_SECRET_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
- name: Set up Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'adopt'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish package
run: mvn -DskipTests=true --batch-mode -P ossrh-publish -Dgpg.passphrase=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
publish-artifact:
name: GitHub Artifacts
needs: test
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Publish artifact on GitHub Packages
run: mvn -B -P github-publish clean deploy -DskipTests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}