-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbitbucket-pipelines.yaml
49 lines (47 loc) · 1.66 KB
/
bitbucket-pipelines.yaml
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
image: openjdk:8-jdk
pipelines:
tags:
'*':
- step:
name: Pre-check for Environment Variables
script:
- echo "Checking if necessary environment variables are defined..."
- |
if [ -z "$MAVEN_USERNAME" ]; then
echo "Error: MAVEN_USERNAME is not defined"
exit 1
fi
if [ -z "$MAVEN_PASSWORD" ]; then
echo "Error: MAVEN_PASSWORD is not defined"
exit 1
fi
if [ -z "$GPG_PRIVATE_KEY" ]; then
echo "Error: GPG_PRIVATE_KEY is not defined"
exit 1
fi
if [ -z "$GPG_PASSPHRASE" ]; then
echo "Error: GPG_PASSPHRASE is not defined"
exit 1
fi
- step:
name: Install GPG and Import Key
script:
- apt-get update && apt-get install -y gnupg
- echo "$GPG_PRIVATE_KEY" | gpg --batch --import
- echo "$GPG_PASSPHRASE" > gpg_passphrase.txt
- gpg --pinentry-mode loopback --batch --passphrase-file gpg_passphrase.txt --keyid-format LONG --list-secret-keys
needs:
- step: Pre-check for Environment Variables
- step:
name: Publish Maven Artifacts
caches:
- maven
script:
- mvn --no-transfer-progress --batch-mode -Dgpg.passphrase=$(cat gpg_passphrase.txt) clean deploy -P release-sign-artifacts -e
after-script:
- rm gpg_passphrase.txt
needs:
- step: Install GPG and Import Key
definitions:
caches:
maven: ~/.m2/repository