Skip to content

Commit ee31017

Browse files
committed
Add github action to stage a release to Artifactory
1 parent c93d747 commit ee31017

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Artifactory Staging
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
releaseVersion:
7+
description: "Release version"
8+
required: true
9+
10+
jobs:
11+
build:
12+
name: Stage release to Artifactory
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout source code
16+
uses: actions/checkout@v3
17+
18+
- name: Set up JDK 17
19+
uses: actions/setup-java@v3
20+
with:
21+
java-version: '17'
22+
distribution: 'temurin'
23+
cache: 'maven'
24+
25+
- name: Capture release version
26+
run: echo RELEASE_VERSION=${{ github.event.inputs.releaseVersion }} >> $GITHUB_ENV
27+
28+
- name: Enforce release rules
29+
run: mvn org.apache.maven.plugins:maven-enforcer-plugin:enforce -Drules=requireReleaseDeps
30+
31+
- name: Update release version
32+
run: mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$RELEASE_VERSION
33+
34+
- name: Build with Maven and deploy to Artifactory staging repository
35+
env:
36+
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
37+
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
38+
run: mvn -P artifactory -s settings.xml --batch-mode -Dmaven.test.skip=true deploy

pom.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,18 @@
344344
</plugins>
345345
</build>
346346
</profile>
347+
<profile>
348+
<id>artifactory</id>
349+
<distributionManagement>
350+
<repository>
351+
<id>spring-staging</id>
352+
<url>https://repo.spring.io/libs-staging-local</url>
353+
<snapshots>
354+
<enabled>false</enabled>
355+
</snapshots>
356+
</repository>
357+
</distributionManagement>
358+
</profile>
347359
</profiles>
348360

349361
<repositories>

settings.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
<username>${env.ARTIFACTORY_USERNAME}</username>
1010
<password>${env.ARTIFACTORY_PASSWORD}</password>
1111
</server>
12+
<server>
13+
<id>spring-staging</id>
14+
<username>${env.ARTIFACTORY_USERNAME}</username>
15+
<password>${env.ARTIFACTORY_PASSWORD}</password>
16+
</server>
1217
</servers>
1318

1419
</settings>

0 commit comments

Comments
 (0)