Release to OSSRH #80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
# Copyright 2021 Adobe Systems Incorporated | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
name: Release to OSSRH | |
# Run workflow on commits to default branch | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseVersion: | |
description: 'Release version (major.minor.patch)' | |
required: false | |
default: '' | |
dryRun: | |
description: 'Dry Run? (false to do an actual release)' | |
required: true | |
default: 'true' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
# Only release from `release/...` branch | |
if: startsWith(github.ref, 'refs/heads/release/') | |
steps: | |
# Check out Git repository | |
- uses: actions/checkout@v3 | |
# Set up environment with Java and Maven | |
- name: Set up JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 8 | |
# Set up dependency cache | |
- name: Cache local Maven repository | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
# Import GPG key from env variable into keychain | |
- name: Import GPG key | |
env: | |
GPG_SECRET_KEYS: ${{ secrets.GPG_SECRET_KEYS }} | |
GPG_OWNERTRUST: ${{ secrets.GPG_OWNERTRUST }} | |
run: | | |
echo $GPG_SECRET_KEYS | base64 --decode | gpg --import --no-tty --batch --yes | |
echo $GPG_OWNERTRUST | base64 --decode | gpg --import-ownertrust --no-tty --batch --yes | |
- name: Configure git user for release commits | |
env: | |
X_GITHUB_USERNAME: ${{ secrets.ADOBE_BOT_GITHUB_USERNAME }} | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "${X_GITHUB_USERNAME}" | |
# Build and deploy to OSSRH, which will automatically sync to Central Repository | |
- name: Deploy to Central Repository | |
env: | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
X_GITHUB_USERNAME: ${{ secrets.ADOBE_BOT_GITHUB_USERNAME }} | |
X_GITHUB_PASSWORD: ${{ secrets.ADOBE_BOT_GITHUB_PASSWORD }} | |
run: mvn -B -Prelease,cloud,ossrh,adobe-public -s ./.github/workflows/settings.xml clean release:prepare release:perform -DreleaseVersion=${{ github.event.inputs.releaseVersion }} -DdryRun=${{ github.event.inputs.dryRun }} -Dmaven.javadoc.failOnError=false |