Skip to content

Commit 84260cb

Browse files
committed
fixes staging snapshots deployment
1 parent dd04f15 commit 84260cb

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

.github/workflows/build.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,22 @@ jobs:
3131
git config --global user.name "github-actions"
3232
git config --global user.email "github-actions@github.com"
3333
34-
STAGING_BRANCH="staging"
3534
# Clone the target branch for deployment
36-
git clone --branch "$STAGING_BRANCH" "https://${GH_ACTOR}:${GH_TOKEN}@github.com/${GH_SNAPSHOTS_REPO}.git" target-branch
37-
35+
git clone --branch main "https://${GH_ACTOR}:${GH_TOKEN}@github.com/${GH_SNAPSHOTS_REPO}.git" target-branch
36+
37+
# Calculate the Maven coordinates and Target Branch
38+
GROUP_ID=$(mvn help:evaluate -Dexpression=project.groupId -q -DforceStdout)
39+
ARTIFACT_ID=$(mvn help:evaluate -Dexpression=project.artifactId -q -DforceStdout)
40+
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
41+
STAGING_BRANCH="staging-$GROUP_ID:$ARTIFACT_ID:$VERSION-$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ")"
42+
3843
# Build the project and deploy to the local repo branch
3944
mvn clean deploy -DaltDeploymentRepository=snapshot-repo::default::file://$(pwd)/target-branch/
4045
4146
# Push the updated snapshots to the branch
4247
cd target-branch
4348
git add -A
44-
git commit -m "Deploy new snapshots [skip ci]" || echo "No changes to commit"
49+
git commit -m "Deploy $GROUP_ID:$ARTIFACT_ID:$VERSION" || echo "No changes to commit"
4550
git push origin "$STAGING_BRANCH"
4651
4752
- name: Generate JaCoCo Badge

0 commit comments

Comments
 (0)