-
Notifications
You must be signed in to change notification settings - Fork 46
158 lines (142 loc) · 6 KB
/
Copy pathrelease.yml
File metadata and controls
158 lines (142 loc) · 6 KB
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
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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 Build
on:
push:
tags:
- v*.**
env:
JAVA_VERSION: 21
PROJECT_NAME: SCIMple
PROJECT_NAME_LOWER: scimple
MAVEN_ARGS: --batch-mode --no-transfer-progress
jobs:
release:
runs-on: ubuntu-latest
outputs:
project-version: ${{ steps.version.outputs.project-version }}
nexus-url: ${{ steps.nexus.outputs.nexus-url }}
svn-dist-url: ${{ steps.svn.outputs.svn-dist-url }}
changelog-md: ${{ steps.mvn.outputs.changelog-md }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 #v6.0.3
with:
fetch-depth: 0 # need history to generate the changelog
- name: Set up Java ${{ env.JAVA_VERSION }}-zulu
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 #v5.2.0
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: zulu
cache: '' # disabled
server-id: apache.releases.https
server-username: NEXUS_USERNAME
server-password: NEXUS_PASSWORD
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}
- name: Resolve the `project-version` from the pom
id: version
shell: bash
run: |
export PROJECT_VERSION=$(./mvnw --non-recursive --quiet --batch-mode \
-DforceStdout=true \
-Dexpression=project.version \
-Dscan=false \
help:evaluate \
| tail -n 1)
echo "project-version=$PROJECT_VERSION"
echo "project-version=$PROJECT_VERSION" >> $GITHUB_OUTPUT
env:
DEVELOCITY_ACCESS_KEY: ${{ secrets.DIRECTORY_DEVELOCITY_ACCESS_KEY }}
- name: Maven Release Build
id: mvn
run: |
./mvnw -V deploy \
-Papache-release -Pci \
--threads=1 \
-Daether.checksums.algorithms=SHA-512,SHA-1,MD5 \
-Ddevelocity.cache.local.enabled=false \
-Ddevelocity.cache.remote.enabled=false
echo "changelog-md=./target/jreleaser/release/CHANGELOG.md" >> $GITHUB_OUTPUT
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USER }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PW }}
DEVELOCITY_ACCESS_KEY: ${{ secrets.DIRECTORY_DEVELOCITY_ACCESS_KEY }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Capture Nexus Staging URL
id: nexus
run: |
export NEXUS_URL=$(awk '/^(stagingRepository.url)/ { gsub(/(^.+=|\\)/, ""); print $1 }' target/nexus-staging/staging/*.properties)
echo "nexus-url: $NEXUS_URL"
echo "nexus-url=$NEXUS_URL" >> $GITHUB_OUTPUT
- name: Upload to Dist to Subversion
id: svn
shell: bash
env:
PROJECT_ID: ${{ env.PROJECT_NAME_LOWER }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
PROJECT_VERSION: ${{ steps.version.outputs.project-version }}
run: |
# Install Subversion
sudo apt install --assume-yes --no-install-recommends subversion
export DIST_FILE_NAME="${PROJECT_ID}-${PROJECT_VERSION}-source-release.zip"
export DIST_FILE_PATH="$(pwd)/target/${DIST_FILE_NAME}"
export SVN_BASE_URL="https://dist.apache.org/repos/dist/dev/directory/${PROJECT_ID}"
export SVN_DIR="/tmp/svn-repo"
# Checkout the SVN repository
svn co \
"${SVN_BASE_URL}" \
"$SVN_DIR"
cd "$SVN_DIR"
# Switch to the distribution folder
[ -d "$PROJECT_VERSION" ] || {
mkdir "$PROJECT_VERSION"
svn add "$PROJECT_VERSION"
}
cd "$PROJECT_VERSION"
# Copy the distribution, signature, and checksum
cp ${DIST_FILE_PATH} .
cp ${DIST_FILE_PATH}.asc .
cp ${DIST_FILE_PATH}.sha512 .
# Add & commit changes
svn add "${DIST_FILE_NAME}"
svn add "${DIST_FILE_NAME}.asc"
svn add "${DIST_FILE_NAME}.sha512"
svn commit \
--username "$SVN_USERNAME" \
--password "$SVN_PASSWORD" \
-m "Added \`${DIST_FILE_NAME}\` artifacts for release \`${PROJECT_VERSION}\`"
export SVN_DIST_URL="${SVN_BASE_URL}/${PROJECT_VERSION}/${DIST_FILE_NAME}"
echo "svn-dist-url=${SVN_DIST_URL}"
echo "svn-dist-url=${SVN_DIST_URL}" >> $GITHUB_OUTPUT
- name: Failure Summary
if: failure()
shell: bash
run: |
./mvnw -N -Pci-templating resources:copy-resources \
-DgitRef=${{ github.ref_name }} \
-DnexusStagingUrl=${{ steps.nexus.outputs.nexus-url }} \
-DsvnDistUrl=${{ steps.svn.outputs.svn-dist-url }}
cat ./target/release-failure-summary.md >> $GITHUB_STEP_SUMMARY
- name: Success Summary
shell: bash
run: |
./mvnw -N -Pci-templating resources:copy-resources \
-DgitRef=${{ github.ref_name }} \
-DnexusStagingUrl=${{ steps.nexus.outputs.nexus-url }} \
-DsvnDistUrl=${{ steps.svn.outputs.svn-dist-url }}
cat ./target/release-success-summary.md >> $GITHUB_STEP_SUMMARY
cat ${{ steps.mvn.outputs.changelog-md }} >> $GITHUB_STEP_SUMMARY