-
Notifications
You must be signed in to change notification settings - Fork 107
203 lines (177 loc) · 6.77 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Copyright 2022 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
on:
workflow_dispatch:
inputs:
releaseVersion:
description: 'Release version (major.minor.patch - patch should be even number)'
required: false
dryRun:
description: 'Dry Run? (uncheck to perform a release)'
required: true
type: boolean
default: true
jobs:
Tag:
runs-on: ubuntu-latest
# Only release from `main` branch
if: github.repository == 'adobe/asset-share-commons' && github.ref == 'refs/heads/main'
outputs:
version: ${{ steps.store-version.outputs.version }}
steps:
# Check out Git repository
- uses: actions/checkout@v4
# Set up environment with Java and Maven
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 8
cache: maven
- name: Initialize mandatory git config
run: |
git config user.name "GitHub Actions"
git config user.email [email protected]
- name: Tag DryRun with Maven
if: ${{ inputs.dryRun }}
run: mvn -B release:clean release:prepare -DreleaseVersion=${{ inputs.releaseVersion }} -DdryRun=true -Pcloud
- name: Tag with Maven
if: ${{ !inputs.dryRun }}
run: mvn -B release:clean release:prepare -DreleaseVersion=${{ inputs.releaseVersion }} -Pcloud
- name: Store Version
id: store-version
run: echo "version=$(grep ^scm.tag= release.properties | sed -e 's/scm.tag=asset-share-commons-//g')" >> $GITHUB_OUTPUT
Github_Release:
needs: Tag
runs-on: ubuntu-latest
if: ${{ !inputs.dryRun }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: asset-share-commons-${{ needs.Tag.outputs.version }}
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
cache: maven
- name: Maven Verify
run: mvn -U clean verify -Pcloud
- name: Generate Release Changelog
id: generate-release-changelog
uses: mikepenz/release-changelog-builder-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
configuration: ".github/.release-changelog-config.json"
toTag: asset-share-commons-${{ needs.Tag.outputs.version }}
- name: Create Release
id: create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: asset-share-commons-${{ needs.Tag.outputs.version }}
release_name: asset-share-commons-${{ needs.Tag.outputs.version }}
body: ${{ steps.generate-release-changelog.outputs.changelog }}
draft: false
prerelease: false
- name: Upload Release Artifacts
id: upload-release-artifacts
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: asset-share-commons-${{ needs.Tag.outputs.version }}
files: |
all/target/asset-share-commons.all-*.zip
ui.content.sample/target/asset-share-commons.ui.content.sample-*.zip
Maven_Central_Deploy:
needs: Tag
runs-on: ubuntu-latest
if: ${{ !inputs.dryRun }}
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: asset-share-commons-${{ needs.Tag.outputs.version }}
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 8
cache: maven
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- 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
# Keeping these separate in case multiple builds are needed.
- name: Build
run: mvn clean deploy -DskipRemoteStaging=true -Pcloud,release
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Deploy to Central
run: mvn nexus-staging:deploy-staged -DautoReleaseAfterClose=true
env:
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
Changelog:
runs-on: ubuntu-latest
needs: Tag
if: ${{ !inputs.dryRun }}
steps:
- name: "Checkout"
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
- name: "Build Changelog Fragment"
id: build_changelog_fragment
uses: mikepenz/release-changelog-builder-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
configuration: ".github/.release-changelog-config.json"
toTag: asset-share-commons-${{ needs.Tag.outputs.version }}
- name: "Build Changelog"
run: |
echo -e "${{steps.build_changelog_fragment.outputs.changelog}}" | cat - CHANGELOG_HISTORY.md > tmp
mv tmp CHANGELOG_HISTORY.md
echo -e '# 📑 Changelog\n\n' | cat - CHANGELOG_HISTORY.md > CHANGELOG.md
- name: Commit Changelog
run: |
git config user.name "GitHub Actions"
git config user.email [email protected]
git add CHANGELOG.md
git add CHANGELOG_HISTORY.md
git commit -m 'Update Changelog.'
git push
Sync_develop:
needs: Changelog
if: ${{ !inputs.dryRun }}
uses: ./.github/workflows/sync-develop.yaml