Skip to content

Publish final artifacts to Maven Central repository #23

Publish final artifacts to Maven Central repository

Publish final artifacts to Maven Central repository #23

Workflow file for this run

name: Publish final artifacts to Maven Central repository
on:
push:
tags:
- armeria-*
env:
LC_ALL: "en_US.UTF-8"
jobs:
publish:
name: Publish final artifacts
if: github.repository == 'line/armeria'
runs-on: self-hosted
steps:
- uses: actions/checkout@v2
- id: setup-jdk-17
name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '17'
- name: Restore the cache
uses: actions/cache@v2
with:
path: |
~/.gradle/wrapper
~/.gradle/caches
key: build-${{ matrix.java }}-${{ runner.os }}-${{ secrets.CACHE_VERSION }}-${{ hashFiles('gradle.properties', 'gradle/wrapper/gradle-wrapper.properties', '**/build.gradle', 'dependencies.yml', '*/package-lock.json') }}
restore-keys: |
build-${{ matrix.java }}-${{ runner.os }}-${{ secrets.CACHE_VERSION }}-
build-${{ matrix.java }}-${{ runner.os }}-
- name: Build with Gradle
run: |
./gradlew --no-daemon --stacktrace --max-workers=8 --parallel -PflakyTests=false build
shell: bash
- name: Publish and close repository
run: |
./gradlew --no-daemon --stacktrace --max-workers=1 publish closeAndReleaseStagingRepository
env:
# Should not use '-P' option with 'secrets' that can cause unexpected results
# if secret values contains white spaces or new lines.
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USER_NAME }}
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_PASSWORD }}
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_KEY_ID }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSWORD }}
shell: bash
- name: Clean up Gradle cache
run: |
rm -f ~/.gradle/caches/modules-2/modules-2.lock
rm -f ~/.gradle/caches/modules-2/gc.properties
shell: bash