-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (84 loc) · 3.29 KB
/
Copy pathdeploy_api_jars.yml
File metadata and controls
99 lines (84 loc) · 3.29 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
name: Pre Release and Deploy API Jars to Artifactory
on:
workflow_dispatch:
push:
paths:
- commons/**
branches:
- main ***REMOVED*** or master or release branches
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up git user
uses: fregante/setup-git-user@v2
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: Configure Maven settings.xml for Artifactory
run: |
mkdir -p ~/.m2
cat <<EOF > ~/.m2/settings.xml
<settings>
<servers>
<server>
<id>data-viz-release</id>
<username>${{ secrets.ARTIFACTORY_USERNAME }}</username>
<password>${{ secrets.ARTIFACTORY_PASSWORD }}</password>
</server>
<server>
<id>data-viz-snapshot</id>
<username>${{ secrets.ARTIFACTORY_USERNAME }}</username>
<password>${{ secrets.ARTIFACTORY_PASSWORD }}</password>
</server>
</servers>
</settings>
EOF
- name: Build and Deploy Parent
run: mvn clean deploy --batch-mode
- name: Build and Deploy
working-directory: ./commons
run: mvn clean deploy --batch-mode
- name: Check for SNAPSHOT versions
id: check_snapshot
run: |
VERSIONS=$(mvn -q --also-make exec:exec -Dexec.executable="echo" -Dexec.args='${project.version}')
echo "All module versions:"
echo "$VERSIONS"
SNAPSHOT_COUNT=$(echo "$VERSIONS" | grep -c "SNAPSHOT" || echo "0")
if [ "$SNAPSHOT_COUNT" -gt 0 ]; then
echo "has_snapshot=true" >> $GITHUB_OUTPUT
echo "✓ Found $SNAPSHOT_COUNT SNAPSHOT version(s), will proceed with release"
else
echo "has_snapshot=false" >> $GITHUB_OUTPUT
echo "✗ No SNAPSHOT versions found, skipping release"
fi
- name: Prepare Maven Release
if: steps.check_snapshot.outputs.has_snapshot == 'true'
run: mvn release:prepare --batch-mode
- name: Perform Maven Release
if: steps.check_snapshot.outputs.has_snapshot == 'true'
run: |
***REMOVED*** Get current version from pom.xml
CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "Current version: $CURRENT_VERSION"
***REMOVED*** Remove -SNAPSHOT and calculate next version
VERSION=${CURRENT_VERSION%-SNAPSHOT}
IFS='.' read -r major minor patch <<< "$VERSION"
NEXT_VERSION="$major.$minor.$((patch + 1))-SNAPSHOT"
***REMOVED*** Perform release
mvn -B release:prepare release:perform \
-DreleaseVersion=$VERSION \
-DdevelopmentVersion=$NEXT_VERSION \
-DtagNameFormat=v@{project.version} \
-DpushChanges=true \
-DlocalCheckout=true \
-DpreparationGoals="clean verify -Dcheckstyle.skip" \
-Dgoals=deploy \
-DskipTests
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Released version $VERSION"