publib 0.2.257
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitattributes +24 -0
- package/CHANGELOG.md +106 -0
- package/LICENSE +202 -0
- package/README.md +233 -0
- package/bin/jsii-release +34 -0
- package/bin/jsii-release-golang +2 -0
- package/bin/jsii-release-maven +361 -0
- package/bin/jsii-release-npm +80 -0
- package/bin/jsii-release-nuget +63 -0
- package/bin/jsii-release-pypi +35 -0
- package/lib/bin/jsii-release-golang.d.ts +2 -0
- package/lib/bin/jsii-release-golang.js +34 -0
- package/lib/help/git.d.ts +68 -0
- package/lib/help/git.js +167 -0
- package/lib/help/os.d.ts +4 -0
- package/lib/help/os.js +35 -0
- package/lib/help/shell.d.ts +37 -0
- package/lib/help/shell.js +70 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +14 -0
- package/lib/targets/go.d.ts +114 -0
- package/lib/targets/go.js +225 -0
- package/package.json +115 -0
- package/package.json.bak +115 -0
- package/scripts/update-package-name.js +12 -0
- package/version.json +3 -0
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -eu # we don't want "pipefail" to implement idempotency
|
|
3
|
+
|
|
4
|
+
###
|
|
5
|
+
#
|
|
6
|
+
# Publishes all maven modules in the specified directory to maven.
|
|
7
|
+
#
|
|
8
|
+
# Usage: ./jsii-release-maven [DIR]
|
|
9
|
+
#
|
|
10
|
+
# DIR is the root directory of a local maven repository (default `dist/java`).
|
|
11
|
+
#
|
|
12
|
+
# MAVEN_STAGING_PROFILE_ID - Maven Central (sonatype) staging profile ID (e.g. 68a05363083174)
|
|
13
|
+
# MAVEN_USERNAME - User name for Sonatype
|
|
14
|
+
# MAVEN_PASSWORD - Password for Sonatype
|
|
15
|
+
# MAVEN_GPG_PRIVATE_KEY - GPG private key where newlines are encoded as "\n"
|
|
16
|
+
# MAVEN_GPG_PRIVATE_KEY_FILE - GPG private key file (mutually exclusive with MAVEN_GPG_PRIVATE_KEY)
|
|
17
|
+
# MAVEN_GPG_PRIVATE_KEY_PASSPHRASE - The passphrase of the provided key.
|
|
18
|
+
# MAVEN_DRYRUN - Set to "true" for a dry run
|
|
19
|
+
# MAVEN_SERVER_ID - Used in maven settings for credential lookup
|
|
20
|
+
# MAVEN_REPOSITORY_URL - Deployment repository when not deploying to maven central
|
|
21
|
+
#
|
|
22
|
+
###
|
|
23
|
+
|
|
24
|
+
###
|
|
25
|
+
#
|
|
26
|
+
# HOW TO CREATE A GPG KEY?
|
|
27
|
+
#
|
|
28
|
+
# gpg --full-generate-key (use RSA, 4096, passphrase)
|
|
29
|
+
#
|
|
30
|
+
# Export and publish the public key:
|
|
31
|
+
# 1. gpg -a --export > public.pem
|
|
32
|
+
# 2. Go to https://keyserver.ubuntu.com/ and submit the public key
|
|
33
|
+
#
|
|
34
|
+
# Export and use the private key:
|
|
35
|
+
# 1. gpg -a --export-secret-keys <fingerprint> > private.pem
|
|
36
|
+
# 2. Set MAVEN_GPG_PRIVATE_KEY_FILE =t point to `private.pem`
|
|
37
|
+
# or
|
|
38
|
+
# 3. You can also export the private key to a single line where newlines are encoded
|
|
39
|
+
# as "\n" and then assign it to MAVEN_GPG_PRIVATE_KEY.
|
|
40
|
+
# MAVEN_GPG_PRIVATE_KEY="$(echo $(cat -e private.pem) | sed 's/\$ /\\n/g' | sed 's/\$$//')"
|
|
41
|
+
#
|
|
42
|
+
###
|
|
43
|
+
|
|
44
|
+
readonly CENTRAL_SERVER="ossrh"
|
|
45
|
+
|
|
46
|
+
# -------------------------------------------------------------------------------------------------
|
|
47
|
+
# we need this monstrosity because this script is installed as a symlink to node_modules/.bin
|
|
48
|
+
# and we need a way to find it's real location so we can reference stuff that's not in .bin
|
|
49
|
+
# https://stackoverflow.com/a/246128
|
|
50
|
+
SOURCE="${BASH_SOURCE[0]}"
|
|
51
|
+
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
|
52
|
+
DIR="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
|
|
53
|
+
SOURCE="$(readlink "$SOURCE")"
|
|
54
|
+
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
|
55
|
+
done
|
|
56
|
+
scriptdir="$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )"
|
|
57
|
+
# -------------------------------------------------------------------------------------------------
|
|
58
|
+
|
|
59
|
+
error() { echo "❌ $@"; exit 1; }
|
|
60
|
+
|
|
61
|
+
validate_central_parameters() {
|
|
62
|
+
[[ -z "${MAVEN_STAGING_PROFILE_ID:-}" ]] && error "MAVEN_STAGING_PROFILE_ID is required"
|
|
63
|
+
return 0
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
validate_non_central_parameters() {
|
|
67
|
+
[[ -z "${MAVEN_SERVER_ID:-}" ]] && error "MAVEN_SERVER_ID is required"
|
|
68
|
+
[[ -z "${MAVEN_REPOSITORY_URL:-}" ]] && error "MAVEN_REPOSITORY_URL is required"
|
|
69
|
+
return 0
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
validate_signing_parameters() {
|
|
73
|
+
[[ -z "${MAVEN_GPG_PRIVATE_KEY_PASSPHRASE:-}" ]] && error "MAVEN_GPG_PRIVATE_KEY_PASSPHRASE is required"
|
|
74
|
+
[[ -z "${MAVEN_GPG_PRIVATE_KEY_FILE:-}" ]] && [[ -z "${MAVEN_GPG_PRIVATE_KEY:-}" ]] && error "MAVEN_GPG_PRIVATE_KEY_FILE or MAVEN_GPG_PRIVATE_KEY is required"
|
|
75
|
+
[[ -n "${MAVEN_GPG_PRIVATE_KEY:-}" ]] && [[ -n "${MAVEN_GPG_PRIVATE_KEY_FILE:-}" ]] && error "Cannot specify both MAVEN_GPG_PRIVATE_KEY and MAVEN_GPG_PRIVATE_KEY_FILE"
|
|
76
|
+
return 0
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
validate_parameters() {
|
|
80
|
+
[[ -z "${MAVEN_USERNAME:-}" ]] && error "MAVEN_USERNAME is required"
|
|
81
|
+
[[ -z "${MAVEN_PASSWORD:-}" ]] && error "MAVEN_PASSWORD is required"
|
|
82
|
+
|
|
83
|
+
if ${is_central}; then
|
|
84
|
+
validate_central_parameters
|
|
85
|
+
else
|
|
86
|
+
validate_non_central_parameters
|
|
87
|
+
fi
|
|
88
|
+
|
|
89
|
+
if (${is_signed} && ! ${is_central}); then
|
|
90
|
+
error "Package signing is currently only supported for Maven Central"
|
|
91
|
+
fi
|
|
92
|
+
|
|
93
|
+
if (${is_signed} || ${is_central}); then
|
|
94
|
+
validate_signing_parameters
|
|
95
|
+
fi
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
import_gpg_key() {
|
|
99
|
+
#---------------------------------------------------------------------------------------------------------------------------------------
|
|
100
|
+
# Import private GPG key
|
|
101
|
+
#---------------------------------------------------------------------------------------------------------------------------------------
|
|
102
|
+
|
|
103
|
+
echo "Importing GPG key..." >&2
|
|
104
|
+
|
|
105
|
+
# GnuPG will occasionally bail out with "gpg: <whatever> failed: Inappropriate ioctl for device", the following attempts to fix
|
|
106
|
+
export GNUPGHOME=$(mktemp -d)
|
|
107
|
+
export GPG_TTY=$(tty)
|
|
108
|
+
|
|
109
|
+
if [ -n "${MAVEN_GPG_PRIVATE_KEY:-}" ]; then
|
|
110
|
+
MAVEN_GPG_PRIVATE_KEY_FILE="${GNUPGHOME}/private.pem"
|
|
111
|
+
echo -e "${MAVEN_GPG_PRIVATE_KEY}" > ${MAVEN_GPG_PRIVATE_KEY_FILE}
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
gpg --allow-secret-key-import --batch --yes --no-tty --import "${MAVEN_GPG_PRIVATE_KEY_FILE}" || {
|
|
115
|
+
error "GPG key import failed"
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
gpg_key_id=$(gpg --list-keys --with-colons | grep pub | cut -d: -f5)
|
|
119
|
+
echo "gpg_key_id=${gpg_key_id}"
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
create_maven_settings() {
|
|
123
|
+
# Create a settings.xml file with the user+password for maven
|
|
124
|
+
mvn_settings="${workdir}/mvn-settings.xml"
|
|
125
|
+
if ${is_signed}; then
|
|
126
|
+
cat > ${mvn_settings} <<-EOF
|
|
127
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
|
128
|
+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
|
|
129
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
130
|
+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
|
|
131
|
+
http://maven.apache.org/xsd/settings-1.0.0.xsd">
|
|
132
|
+
<servers>
|
|
133
|
+
<server>
|
|
134
|
+
<id>${server_id}</id>
|
|
135
|
+
<username>\${env.MAVEN_USERNAME}</username>
|
|
136
|
+
<password>\${env.MAVEN_PASSWORD}</password>
|
|
137
|
+
</server>
|
|
138
|
+
<server>
|
|
139
|
+
<id>gpg.passphrase</id>
|
|
140
|
+
<passphrase>\${env.MAVEN_GPG_PRIVATE_KEY_PASSPHRASE}</passphrase>
|
|
141
|
+
</server>
|
|
142
|
+
</servers>
|
|
143
|
+
</settings>
|
|
144
|
+
EOF
|
|
145
|
+
else
|
|
146
|
+
cat > ${mvn_settings} <<-EOF
|
|
147
|
+
<?xml version="1.0" encoding="UTF-8" ?>
|
|
148
|
+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
|
|
149
|
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
150
|
+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
|
|
151
|
+
http://maven.apache.org/xsd/settings-1.0.0.xsd">
|
|
152
|
+
<servers>
|
|
153
|
+
<server>
|
|
154
|
+
<id>${server_id}</id>
|
|
155
|
+
<username>\${env.MAVEN_USERNAME}</username>
|
|
156
|
+
<password>\${env.MAVEN_PASSWORD}</password>
|
|
157
|
+
</server>
|
|
158
|
+
</servers>
|
|
159
|
+
</settings>
|
|
160
|
+
EOF
|
|
161
|
+
fi
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
sign_artifacts() {
|
|
165
|
+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
|
166
|
+
echo " Preparing repository"
|
|
167
|
+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
|
168
|
+
|
|
169
|
+
# on a mac, --pinentry-mode to "loopback" are required and I couldn't find a
|
|
170
|
+
# way to do so via -Dgpg.gpgArguments or the settings file, so here we are.
|
|
171
|
+
local gpg_exec="gpg"
|
|
172
|
+
if [[ "$(uname)" == "Darwin" ]]; then
|
|
173
|
+
gpg_exec="/tmp/jsii-release-gpg.sh"
|
|
174
|
+
echo "#!/bin/bash" > $gpg_exec
|
|
175
|
+
echo "exec gpg --pinentry-mode loopback \"\$@\"" >> $gpg_exec
|
|
176
|
+
chmod +x $gpg_exec
|
|
177
|
+
fi
|
|
178
|
+
|
|
179
|
+
# Sign and stage our artifacts into a local directory
|
|
180
|
+
for pom in ${poms}; do
|
|
181
|
+
$mvn --settings=${mvn_settings} gpg:sign-and-deploy-file \
|
|
182
|
+
-X \
|
|
183
|
+
-Durl=file://${staging} \
|
|
184
|
+
-DrepositoryId=${server_id} \
|
|
185
|
+
-Dgpg.homedir=${GNUPGHOME} \
|
|
186
|
+
-Dgpg.keyname=0x${gpg_key_id} \
|
|
187
|
+
-Dgpg.executable=${gpg_exec} \
|
|
188
|
+
-DpomFile=${pom} \
|
|
189
|
+
-Dfile=${pom/.pom/.jar} \
|
|
190
|
+
-Dsources=${pom/.pom/-sources.jar} \
|
|
191
|
+
-Djavadoc=${pom/.pom/-javadoc.jar}
|
|
192
|
+
done
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
deploy_central() {
|
|
196
|
+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
|
197
|
+
echo " Deploying and closing repository..."
|
|
198
|
+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
|
199
|
+
|
|
200
|
+
staging_output="${workdir}/deploy-output.txt"
|
|
201
|
+
$mvn --settings=${mvn_settings} \
|
|
202
|
+
org.sonatype.plugins:nexus-staging-maven-plugin:1.6.5:deploy-staged-repository \
|
|
203
|
+
-DrepositoryDirectory=${staging} \
|
|
204
|
+
-DnexusUrl=${MAVEN_ENDPOINT:-https://oss.sonatype.org} \
|
|
205
|
+
-DserverId=${server_id} \
|
|
206
|
+
-DautoReleaseAfterClose=true \
|
|
207
|
+
-DstagingProgressTimeoutMinutes=30 \
|
|
208
|
+
-DstagingProfileId=${MAVEN_STAGING_PROFILE_ID} | tee ${staging_output}
|
|
209
|
+
|
|
210
|
+
# we need to consule PIPESTATUS sinec "tee" is the last command
|
|
211
|
+
if [ ${PIPESTATUS[0]} -ne 0 ]; then
|
|
212
|
+
error "Repository deployment failed"
|
|
213
|
+
fi
|
|
214
|
+
|
|
215
|
+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
|
216
|
+
echo " Releasing repository"
|
|
217
|
+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
|
218
|
+
|
|
219
|
+
# Extract the ID of the closed repository from the log output of "deploy-staged-repository"
|
|
220
|
+
# This is because "deploy-staged-repository" doesn't seem to support autoReleaseAfterClose
|
|
221
|
+
# See https://issues.sonatype.org/browse/OSSRH-42487
|
|
222
|
+
if $dry_run; then
|
|
223
|
+
echo 'Closing staging repository with ID "dummyrepo"' > ${staging_output}
|
|
224
|
+
fi
|
|
225
|
+
|
|
226
|
+
repository_id="$(cat ${staging_output} | grep "Closing staging repository with ID" | cut -d'"' -f2)"
|
|
227
|
+
if [ -z "${repository_id}" ]; then
|
|
228
|
+
echo "❌ Unable to extract repository ID from deploy-staged-repository output."
|
|
229
|
+
echo "This means it failed to close or there was an unexpected problem."
|
|
230
|
+
echo "At any rate, we can't release it. Sorry"
|
|
231
|
+
exit 1
|
|
232
|
+
fi
|
|
233
|
+
|
|
234
|
+
echo "Repository ID: ${repository_id}"
|
|
235
|
+
|
|
236
|
+
# Create a dummy pom.xml because the "release" goal needs one, but it doesn't care about it at all
|
|
237
|
+
release_pom="${workdir}/release-pom.xml"
|
|
238
|
+
cat > ${release_pom} <<HERE
|
|
239
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
240
|
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
241
|
+
<modelVersion>4.0.0</modelVersion>
|
|
242
|
+
<groupId>dummy</groupId>
|
|
243
|
+
<artifactId>dummy</artifactId>
|
|
244
|
+
<version>0.0.0</version>
|
|
245
|
+
</project>
|
|
246
|
+
HERE
|
|
247
|
+
|
|
248
|
+
# Release!
|
|
249
|
+
release_output="${workdir}/release-output.txt"
|
|
250
|
+
$mvn --settings ${mvn_settings} -f ${release_pom} \
|
|
251
|
+
org.sonatype.plugins:nexus-staging-maven-plugin:1.6.5:release \
|
|
252
|
+
-DserverId=${server_id} \
|
|
253
|
+
-DnexusUrl=${MAVEN_ENDPOINT:-https://oss.sonatype.org} \
|
|
254
|
+
-DstagingProfileId=${MAVEN_STAGING_PROFILE_ID} \
|
|
255
|
+
-DstagingProgressTimeoutMinutes=30 \
|
|
256
|
+
-DstagingRepositoryId=${repository_id} | tee ${release_output}
|
|
257
|
+
|
|
258
|
+
# If release failed, check if this was caused because we are trying to publish
|
|
259
|
+
# the same version again, which is not an error. The magic string "does not
|
|
260
|
+
# allow updating artifact" for a ".pom" file indicates that we are trying to
|
|
261
|
+
# override an existing version. Otherwise, fail!
|
|
262
|
+
if [ ${PIPESTATUS[0]} -ne 0 ]; then
|
|
263
|
+
if cat ${release_output} | grep "does not allow updating artifact" | grep -q ".pom"; then
|
|
264
|
+
echo "⚠️ Artifact already published. Skipping"
|
|
265
|
+
else
|
|
266
|
+
error "Release failed"
|
|
267
|
+
fi
|
|
268
|
+
fi
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
deploy_non_central() {
|
|
272
|
+
release_output="${workdir}/release-output.txt"
|
|
273
|
+
for pom in ${poms}; do
|
|
274
|
+
$mvn --settings=${mvn_settings} deploy:deploy-file \
|
|
275
|
+
-Durl=${MAVEN_REPOSITORY_URL} \
|
|
276
|
+
-DrepositoryId=${server_id} \
|
|
277
|
+
-Dfile=${pom/.pom/.jar} \
|
|
278
|
+
-DpomFile=${pom} \
|
|
279
|
+
-Dsources=${pom/.pom/-sources.jar} \
|
|
280
|
+
-Djavadoc=${pom/.pom/-javadoc.jar} | tee ${release_output}
|
|
281
|
+
|
|
282
|
+
# If release failed, check if this was caused because we are trying to publish
|
|
283
|
+
# the same version again, which is not an error. The magic string "409 Conflict"
|
|
284
|
+
# indicates that we are trying to
|
|
285
|
+
# override an existing version. Otherwise, fail!
|
|
286
|
+
if [ ${PIPESTATUS[0]} -ne 0 ]; then
|
|
287
|
+
if cat ${release_output} | grep -q "409 Conflict"; then
|
|
288
|
+
echo "⚠️ Artifact already published. Skipping"
|
|
289
|
+
else
|
|
290
|
+
error "Release failed"
|
|
291
|
+
fi
|
|
292
|
+
fi
|
|
293
|
+
done
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
main() {
|
|
297
|
+
cd "${1:-"dist/java"}"
|
|
298
|
+
|
|
299
|
+
server_id="${MAVEN_SERVER_ID:-"${CENTRAL_SERVER}"}"
|
|
300
|
+
if [[ "${server_id}" == "${CENTRAL_SERVER}" ]]; then
|
|
301
|
+
is_central=true
|
|
302
|
+
else
|
|
303
|
+
is_central=false
|
|
304
|
+
fi
|
|
305
|
+
|
|
306
|
+
if [[ -n "${MAVEN_GPG_PRIVATE_KEY_FILE:-}" ]] || [[ -n "${MAVEN_GPG_PRIVATE_KEY:-}" ]]; then
|
|
307
|
+
is_signed=true
|
|
308
|
+
else
|
|
309
|
+
is_signed=false
|
|
310
|
+
fi
|
|
311
|
+
|
|
312
|
+
validate_parameters
|
|
313
|
+
|
|
314
|
+
if [[ -n "${MAVEN_DRYRUN:-}" ]]; then
|
|
315
|
+
echo "==========================================="
|
|
316
|
+
echo " 🏜️ DRY-RUN MODE 🏜️"
|
|
317
|
+
echo "==========================================="
|
|
318
|
+
mvn="echo mvn"
|
|
319
|
+
dry_run=true
|
|
320
|
+
else
|
|
321
|
+
mvn=mvn
|
|
322
|
+
dry_run=false
|
|
323
|
+
fi
|
|
324
|
+
|
|
325
|
+
if ${is_signed}; then
|
|
326
|
+
import_gpg_key
|
|
327
|
+
fi
|
|
328
|
+
|
|
329
|
+
poms="$(find . -name '*.pom')"
|
|
330
|
+
if [ -z "${poms}" ]; then
|
|
331
|
+
error "No JARS to publish: no .pom files found under $PWD"
|
|
332
|
+
fi
|
|
333
|
+
|
|
334
|
+
if ${is_central}; then
|
|
335
|
+
echo "📦 Publishing to Maven Central"
|
|
336
|
+
else
|
|
337
|
+
echo "📦 Publishing to ${server_id}"
|
|
338
|
+
fi
|
|
339
|
+
|
|
340
|
+
staging=$(mktemp -d)
|
|
341
|
+
workdir=$(mktemp -d)
|
|
342
|
+
echo ${workdir}
|
|
343
|
+
|
|
344
|
+
create_maven_settings
|
|
345
|
+
|
|
346
|
+
if ${is_signed}; then
|
|
347
|
+
# This currently only works with Maven Central
|
|
348
|
+
sign_artifacts
|
|
349
|
+
fi
|
|
350
|
+
|
|
351
|
+
if ${is_central}; then
|
|
352
|
+
deploy_central
|
|
353
|
+
else
|
|
354
|
+
deploy_non_central
|
|
355
|
+
fi
|
|
356
|
+
|
|
357
|
+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
|
358
|
+
echo "✅ All Done!"
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
main "$@"; exit
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -eu
|
|
3
|
+
|
|
4
|
+
###
|
|
5
|
+
#
|
|
6
|
+
# Publishes all *.tgz files to npm
|
|
7
|
+
#
|
|
8
|
+
# Usage: ./jsii-release-npm [DIR]
|
|
9
|
+
#
|
|
10
|
+
# DIR: directory where npm tarballs are found (default is `dist/js`).
|
|
11
|
+
#
|
|
12
|
+
# NPM_TOKEN (optional): registry authentication token (either from npmjs or a GitHub personal access token), not used for AWS CodeArtifact
|
|
13
|
+
# NPM_REGISTRY (optional): the registry URL (defaults to "registry.npmjs.org")
|
|
14
|
+
# AWS_ACCESS_KEY_ID (optional): If AWS CodeArtifact is used as registry, an AWS access key can be spedified.
|
|
15
|
+
# AWS_SECRET_ACCESS_KEY (optional): Secret access key that belongs to the AWS access key.
|
|
16
|
+
# AWS_ROLE_TO_ASSUME (optional): If AWS CodeArtifact is used as registry and need to assume role.
|
|
17
|
+
#
|
|
18
|
+
###
|
|
19
|
+
|
|
20
|
+
dir="${1:-"dist/js"}"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
if ! [ -z "${NPM_REGISTRY:-}" ] && [[ $NPM_REGISTRY =~ .codeartifact.*.amazonaws.com ]]; then
|
|
24
|
+
codeartifact_account="$(echo $NPM_REGISTRY | cut -d. -f1 | rev | cut -d- -f1 | rev)"
|
|
25
|
+
codeartifact_subdomain="$(echo $NPM_REGISTRY | cut -d. -f1)"
|
|
26
|
+
codeartifact_domain="$(echo $codeartifact_subdomain | cut -b -$((${#codeartifact_subdomain}-${#codeartifact_account}-1)))"
|
|
27
|
+
codeartifact_region="$(echo $NPM_REGISTRY | cut -d. -f4)"
|
|
28
|
+
export AWS_DEFAULT_REGION="$(echo $codeartifact_region)"
|
|
29
|
+
if [ -n "${AWS_ROLE_TO_ASSUME:-}" ]; then
|
|
30
|
+
credentials=`aws sts assume-role --role-session-name "jsii-release-code-artifact" --role-arn ${AWS_ROLE_TO_ASSUME} --output text | sed -n '2 p'`
|
|
31
|
+
export AWS_ACCESS_KEY_ID="$(echo $credentials | cut -d' ' -f2)"
|
|
32
|
+
export AWS_SECRET_ACCESS_KEY="$(echo $credentials | cut -d' ' -f4)"
|
|
33
|
+
export AWS_SESSION_TOKEN="$(echo $credentials | cut -d' ' -f5)"
|
|
34
|
+
fi
|
|
35
|
+
NPM_TOKEN=`aws codeartifact get-authorization-token --domain $codeartifact_domain --domain-owner $codeartifact_account --region $codeartifact_region --query authorizationToken --output text`
|
|
36
|
+
elif [ -z "${NPM_TOKEN:-}" ]; then
|
|
37
|
+
echo "NPM_TOKEN is required"
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
NPM_REGISTRY=${NPM_REGISTRY:-"registry.npmjs.org"}
|
|
42
|
+
echo "//${NPM_REGISTRY%%/}/:_authToken=${NPM_TOKEN}" > ~/.npmrc
|
|
43
|
+
|
|
44
|
+
# this overrides any registry configuration defined externally. For example, yarn sets the registry to the yarn proxy
|
|
45
|
+
# which requires `yarn login`. but since we are logging in through ~/.npmrc, we must make sure we publish directly to npm.
|
|
46
|
+
export NPM_CONFIG_REGISTRY="https://${NPM_REGISTRY}"
|
|
47
|
+
|
|
48
|
+
# dist-tags
|
|
49
|
+
tag=""
|
|
50
|
+
if [ -n "${NPM_DIST_TAG:-}" ]; then
|
|
51
|
+
tag="--tag ${NPM_DIST_TAG}"
|
|
52
|
+
echo "Publishing under the following dist-tag: ${NPM_DIST_TAG}"
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
log=$(mktemp -d)/npmlog.txt
|
|
56
|
+
|
|
57
|
+
for file in ${dir}/**.tgz; do
|
|
58
|
+
npm publish ${tag} ${file} 2>&1 | tee ${log}
|
|
59
|
+
exit_code="${PIPESTATUS[0]}"
|
|
60
|
+
|
|
61
|
+
if [ ${exit_code} -ne 0 ]; then
|
|
62
|
+
|
|
63
|
+
# error returned from npmjs
|
|
64
|
+
if cat ${log} | grep -q "You cannot publish over the previously published versions"; then
|
|
65
|
+
echo "SKIPPING: already published"
|
|
66
|
+
continue
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
# error returned from github packages
|
|
70
|
+
if cat ${log} | grep -q "Cannot publish over existing version"; then
|
|
71
|
+
echo "SKIPPING: already published"
|
|
72
|
+
continue
|
|
73
|
+
fi
|
|
74
|
+
|
|
75
|
+
echo "ERROR"
|
|
76
|
+
exit 1
|
|
77
|
+
fi
|
|
78
|
+
done
|
|
79
|
+
|
|
80
|
+
echo "SUCCESS"
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
scriptdir=$(cd $(dirname $0) && pwd)
|
|
3
|
+
set -eu # we don't want "pipefail" to implement idempotency
|
|
4
|
+
|
|
5
|
+
###
|
|
6
|
+
#
|
|
7
|
+
# Publishes all *.nupkg to NuGet
|
|
8
|
+
#
|
|
9
|
+
# Usage: ./jsii-release-nuget [DIR]
|
|
10
|
+
#
|
|
11
|
+
# DIR is a directory with *.nupkg files (default is 'dist/dotnet')
|
|
12
|
+
#
|
|
13
|
+
# NUGET_API_KEY (required): API key for nuget
|
|
14
|
+
#
|
|
15
|
+
###
|
|
16
|
+
|
|
17
|
+
cd "${1:-"dist/dotnet"}"
|
|
18
|
+
|
|
19
|
+
if [ -z "${NUGET_API_KEY:-}" ]; then
|
|
20
|
+
echo "NUGET_API_KEY is required"
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
packages=$(find . -name '*.nupkg' -not -iname '*.symbols.nupkg')
|
|
25
|
+
if [ -z "${packages}" ]; then
|
|
26
|
+
echo "❌ No *.nupkg files found under $PWD. Nothing to publish"
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
echo "Publishing NuGet packages..."
|
|
31
|
+
|
|
32
|
+
nuget_source="${NUGET_SERVER:-"https://api.nuget.org/v3/index.json"}"
|
|
33
|
+
nuget_symbol_source="https://nuget.smbsrc.net/"
|
|
34
|
+
|
|
35
|
+
log=$(mktemp -d)/log.txt
|
|
36
|
+
|
|
37
|
+
for package_dir in ${packages}; do
|
|
38
|
+
echo "📦 Publishing ${package_dir} to NuGet"
|
|
39
|
+
(
|
|
40
|
+
cd $(dirname $package_dir)
|
|
41
|
+
nuget_package_name=$(basename $package_dir)
|
|
42
|
+
nuget_package_base=${nuget_package_name%.nupkg}
|
|
43
|
+
|
|
44
|
+
[ -f "${nuget_package_base}.snupkg" ] || echo "⚠️ No symbols package was found!"
|
|
45
|
+
|
|
46
|
+
# The .snupkg will be published at the same time as the .nupkg if both are in the current folder (which is the case)
|
|
47
|
+
dotnet nuget push $nuget_package_name -k ${NUGET_API_KEY} -s ${nuget_source} | tee ${log}
|
|
48
|
+
exit_code="${PIPESTATUS[0]}"
|
|
49
|
+
|
|
50
|
+
# If push failed, check if this was caused because we are trying to publish
|
|
51
|
+
# the same version again, which is not an error by searching for a magic string in the log
|
|
52
|
+
# ugly, yes!
|
|
53
|
+
if cat ${log} | grep -q -e "already exists and cannot be modified" -e "409 (Conflict)"; then
|
|
54
|
+
echo "⚠️ Artifact already published. Skipping"
|
|
55
|
+
elif [ "${exit_code}" -ne 0 ]; then
|
|
56
|
+
echo "❌ Release failed"
|
|
57
|
+
exit 1
|
|
58
|
+
fi
|
|
59
|
+
)
|
|
60
|
+
done
|
|
61
|
+
|
|
62
|
+
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
|
|
63
|
+
echo "✅ All Done!"
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
###
|
|
5
|
+
#
|
|
6
|
+
# Publishes all *.whl files to PyPI
|
|
7
|
+
#
|
|
8
|
+
# Usage: ./jsii-release-pypi [DIR]
|
|
9
|
+
#
|
|
10
|
+
# DIR is where *.whl files are looked up (default is "dist/python")
|
|
11
|
+
#
|
|
12
|
+
# TWINE_USERNAME (required)
|
|
13
|
+
# TWINE_PASSWORD (required)
|
|
14
|
+
#
|
|
15
|
+
###
|
|
16
|
+
|
|
17
|
+
cd "${1:-"dist/python"}"
|
|
18
|
+
|
|
19
|
+
[ -z "${TWINE_USERNAME:-}" ] && {
|
|
20
|
+
echo "Missing TWINE_USERNAME"
|
|
21
|
+
exit 1
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[ -z "${TWINE_PASSWORD:-}" ] && {
|
|
25
|
+
echo "Missing TWINE_PASSWORD"
|
|
26
|
+
exit 1
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if [ -z "$(ls *.whl)" ]; then
|
|
30
|
+
echo "cannot find any .whl files in $PWD"
|
|
31
|
+
exit 1
|
|
32
|
+
fi
|
|
33
|
+
|
|
34
|
+
python3 -m pip install --user --upgrade twine
|
|
35
|
+
python3 -m twine upload --skip-existing *
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
6
|
+
}) : (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
o[k2] = m[k];
|
|
9
|
+
}));
|
|
10
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
11
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
12
|
+
}) : function(o, v) {
|
|
13
|
+
o["default"] = v;
|
|
14
|
+
});
|
|
15
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
16
|
+
if (mod && mod.__esModule) return mod;
|
|
17
|
+
var result = {};
|
|
18
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
19
|
+
__setModuleDefault(result, mod);
|
|
20
|
+
return result;
|
|
21
|
+
};
|
|
22
|
+
var _a;
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
const go = __importStar(require("../targets/go"));
|
|
25
|
+
const releaser = new go.GoReleaser({
|
|
26
|
+
dir: process.argv[2],
|
|
27
|
+
branch: process.env.GIT_BRANCH,
|
|
28
|
+
dryRun: ((_a = process.env.DRYRUN) !== null && _a !== void 0 ? _a : 'false').toLowerCase() === 'true',
|
|
29
|
+
email: process.env.GIT_USER_EMAIL,
|
|
30
|
+
username: process.env.GIT_USER_NAME,
|
|
31
|
+
version: process.env.VERSION,
|
|
32
|
+
});
|
|
33
|
+
releaser.release();
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianNpaS1yZWxlYXNlLWdvbGFuZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iaW4vanNpaS1yZWxlYXNlLWdvbGFuZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUNBLGtEQUFvQztBQUVwQyxNQUFNLFFBQVEsR0FBRyxJQUFJLEVBQUUsQ0FBQyxVQUFVLENBQUM7SUFDakMsR0FBRyxFQUFFLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDO0lBQ3BCLE1BQU0sRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDLFVBQVU7SUFDOUIsTUFBTSxFQUFFLE9BQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxNQUFNLG1DQUFJLE9BQU8sQ0FBQyxDQUFDLFdBQVcsRUFBRSxLQUFLLE1BQU07SUFDaEUsS0FBSyxFQUFFLE9BQU8sQ0FBQyxHQUFHLENBQUMsY0FBYztJQUNqQyxRQUFRLEVBQUUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxhQUFhO0lBQ25DLE9BQU8sRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDLE9BQU87Q0FDN0IsQ0FBQyxDQUFDO0FBRUgsUUFBUSxDQUFDLE9BQU8sRUFBRSxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiIyEvdXNyL2Jpbi9lbnYgbm9kZVxuaW1wb3J0ICogYXMgZ28gZnJvbSAnLi4vdGFyZ2V0cy9nbyc7XG5cbmNvbnN0IHJlbGVhc2VyID0gbmV3IGdvLkdvUmVsZWFzZXIoe1xuICBkaXI6IHByb2Nlc3MuYXJndlsyXSxcbiAgYnJhbmNoOiBwcm9jZXNzLmVudi5HSVRfQlJBTkNILFxuICBkcnlSdW46IChwcm9jZXNzLmVudi5EUllSVU4gPz8gJ2ZhbHNlJykudG9Mb3dlckNhc2UoKSA9PT0gJ3RydWUnLFxuICBlbWFpbDogcHJvY2Vzcy5lbnYuR0lUX1VTRVJfRU1BSUwsXG4gIHVzZXJuYW1lOiBwcm9jZXNzLmVudi5HSVRfVVNFUl9OQU1FLFxuICB2ZXJzaW9uOiBwcm9jZXNzLmVudi5WRVJTSU9OLFxufSk7XG5cbnJlbGVhc2VyLnJlbGVhc2UoKTsiXX0=
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clones a repository from GitHub. Requires a `GITHUB_TOKEN` env variable.
|
|
3
|
+
*
|
|
4
|
+
* @param repositoryUrl the repository to clone.
|
|
5
|
+
* @param targetDir the clone directory.
|
|
6
|
+
*/
|
|
7
|
+
export declare function clone(repositoryUrl: string, targetDir: string): void;
|
|
8
|
+
/**
|
|
9
|
+
* Query the git index for changes.
|
|
10
|
+
*
|
|
11
|
+
* @return True if changes exist, False otherwise.
|
|
12
|
+
*/
|
|
13
|
+
export declare function diffIndex(): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Add files to the index.
|
|
16
|
+
*
|
|
17
|
+
* @param p the path.
|
|
18
|
+
*/
|
|
19
|
+
export declare function add(p: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Commit.
|
|
22
|
+
*
|
|
23
|
+
* @param message the commit message.
|
|
24
|
+
*/
|
|
25
|
+
export declare function commit(message: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Initialize a repository.
|
|
28
|
+
*/
|
|
29
|
+
export declare function init(): void;
|
|
30
|
+
/**
|
|
31
|
+
* Cerate a tag.
|
|
32
|
+
*
|
|
33
|
+
* @param name tag name.
|
|
34
|
+
* @returns true if the tag was created, false if it already exists.
|
|
35
|
+
*/
|
|
36
|
+
export declare function tag(name: string): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Push a ref to origin.
|
|
39
|
+
*
|
|
40
|
+
* @param ref the ref
|
|
41
|
+
*/
|
|
42
|
+
export declare function push(ref: string): void;
|
|
43
|
+
/**
|
|
44
|
+
* Checkout to a new branch. Creates a new one if `options.createIfMissing` is True and the branch doesn't exist.
|
|
45
|
+
*
|
|
46
|
+
* @param branch the branch.
|
|
47
|
+
* @param options options.
|
|
48
|
+
*/
|
|
49
|
+
export declare function checkout(branch: string, options: {
|
|
50
|
+
createIfMissing?: boolean;
|
|
51
|
+
}): void;
|
|
52
|
+
/**
|
|
53
|
+
* Fetch the configured git user name for the current directory.
|
|
54
|
+
* Returns undefined if not configured.
|
|
55
|
+
*/
|
|
56
|
+
export declare function username(): string | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Fetch the configured git user email for the current directory.
|
|
59
|
+
* Returns undefined if not configured.
|
|
60
|
+
*/
|
|
61
|
+
export declare function email(): string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Identify the committer with a username and email.
|
|
64
|
+
*
|
|
65
|
+
* @param user the username.
|
|
66
|
+
* @param email the email address.
|
|
67
|
+
*/
|
|
68
|
+
export declare function identify(user: string, address: string): void;
|