-
Notifications
You must be signed in to change notification settings - Fork 753
79 lines (72 loc) · 3.1 KB
/
maven-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 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: 11
# 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