Skip to content

Commit f90e965

Browse files
committed
Update workflows to use Spring IO actions
1 parent 2b29050 commit f90e965

File tree

6 files changed

+70
-126
lines changed

6 files changed

+70
-126
lines changed

.github/release-files-spec.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"files": [
3+
{
4+
"aql": {
5+
"items.find": {
6+
"$and": [
7+
{
8+
"@build.name": "${buildname}",
9+
"@build.number": "${buildnumber}",
10+
"path": { "$match": "org/springframework/batch/spring-batch-*" }
11+
}
12+
]
13+
}
14+
},
15+
"target": "nexus/"
16+
}
17+
]
18+
}

.github/workflows/artifactory-staging.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,32 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- name: Checkout source code
16-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4.2.2
1717

1818
- name: Set up JDK 17
19-
uses: actions/setup-java@v3
19+
uses: actions/setup-java@v4.7.1
2020
with:
2121
java-version: '17'
2222
distribution: 'temurin'
2323
cache: 'maven'
2424

25-
- name: Capture release version
26-
run: echo RELEASE_VERSION=${{ github.event.inputs.releaseVersion }} >> $GITHUB_ENV
27-
2825
- name: Update release version
29-
run: mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$RELEASE_VERSION
26+
run: mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${{ github.event.inputs.releaseVersion }}
3027

3128
- name: Enforce release rules
3229
run: mvn org.apache.maven.plugins:maven-enforcer-plugin:enforce -Drules=requireReleaseDeps
3330

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-staging -s settings.xml --batch-mode -Dmaven.test.skip=true deploy
31+
- name: Build with Maven
32+
run: mvn -DaltDeploymentRepository=local::file:deployment-repository --no-transfer-progress --batch-mode -Dmaven.test.skip=true deploy
33+
34+
- name: Deploy to Artifactory
35+
uses: spring-io/artifactory-deploy-action@v0.0.2
36+
with:
37+
uri: 'https://repo.spring.io'
38+
username: ${{ secrets.ARTIFACTORY_USERNAME }}
39+
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
40+
build-name: 'spring-batch-${{ github.event.inputs.releaseVersion }}'
41+
repository: 'libs-staging-local'
42+
folder: 'deployment-repository'
43+
signing-key: ${{ secrets.GPG_PRIVATE_KEY }}
44+
signing-passphrase: ${{ secrets.GPG_PASSPHRASE }}

.github/workflows/continuous-integration.yml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,34 @@ on: [push, pull_request, workflow_dispatch]
44

55
jobs:
66
build:
7-
name: Build branch
7+
name: Build main branch
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout source code
11-
uses: actions/checkout@v3
11+
uses: actions/checkout@v4.2.2
1212

1313
- name: Set up JDK 17
14-
uses: actions/setup-java@v3
14+
uses: actions/setup-java@v4.7.1
1515
with:
1616
java-version: '17'
1717
distribution: 'temurin'
1818
cache: 'maven'
1919

2020
- name: Build with Maven
21-
if: ${{ github.repository != 'spring-projects/spring-batch' || github.ref_name != 'main' }}
22-
run: mvn -s settings.xml --batch-mode --update-snapshots verify
21+
run: mvn -DaltDeploymentRepository=local::file:deployment-repository --no-transfer-progress --batch-mode --update-snapshots deploy
2322

24-
- name: Build with Maven and deploy to Artifactory
23+
- name: Deploy to Artifactory
2524
if: ${{ github.repository == 'spring-projects/spring-batch' && github.ref_name == 'main' }}
26-
env:
27-
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
28-
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
29-
run: mvn -s settings.xml --batch-mode --update-snapshots deploy
25+
uses: spring-io/artifactory-deploy-action@v0.0.2
26+
with:
27+
uri: 'https://repo.spring.io'
28+
username: ${{ secrets.ARTIFACTORY_USERNAME }}
29+
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
30+
build-name: 'spring-batch-main'
31+
repository: 'libs-snapshot-local'
32+
folder: 'deployment-repository'
33+
signing-key: ${{ secrets.GPG_PRIVATE_KEY }}
34+
signing-passphrase: ${{ secrets.GPG_PASSPHRASE }}
3035

3136
- name: Generate Java docs
3237
run: mvn javadoc:aggregate

.github/workflows/maven-central-release.yml

Lines changed: 20 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -3,81 +3,30 @@ name: Maven Central Release
33
on:
44
workflow_dispatch:
55
inputs:
6-
releaseVersion:
7-
description: "Release version"
6+
buildName:
7+
description: "Artifactory build name"
8+
required: true
9+
buildNumber:
10+
description: "Artifactory build number"
811
required: true
912

1013
jobs:
11-
build:
14+
15+
release:
1216
runs-on: ubuntu-latest
1317
steps:
14-
15-
- name: Capture release version
16-
run: echo RELEASE_VERSION=${{ github.event.inputs.releaseVersion }} >> $GITHUB_ENV
17-
18-
- name: Prepare directory structure
19-
run: |
20-
mkdir -p nexus/org/springframework/batch/spring-batch-bom/$RELEASE_VERSION
21-
mkdir -p nexus/org/springframework/batch/spring-batch-infrastructure/$RELEASE_VERSION
22-
mkdir -p nexus/org/springframework/batch/spring-batch-core/$RELEASE_VERSION
23-
mkdir -p nexus/org/springframework/batch/spring-batch-test/$RELEASE_VERSION
24-
mkdir -p nexus/org/springframework/batch/spring-batch-integration/$RELEASE_VERSION
25-
26-
- name: Download release files from Artifactory
18+
- name: Checkout source code
19+
uses: actions/checkout@v4.2.2
20+
- name: Set Up JFrog CLI
21+
uses: jfrog/setup-jfrog-cli@9fe0f98bd45b19e6e931d457f4e98f8f84461fb5 # v4.4.1
2722
env:
28-
ARTIFACTORY_URL: "https://repo.spring.io/libs-staging-local/org/springframework/batch"
29-
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
30-
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
31-
run: |
32-
echo "Downloading BOM artifacts"
33-
cd nexus/org/springframework/batch/spring-batch-bom/$RELEASE_VERSION
34-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-bom/$RELEASE_VERSION/spring-batch-bom-$RELEASE_VERSION.pom
35-
36-
echo "Downloading infrastructure artifacts"
37-
cd ../../../../../..
38-
cd nexus/org/springframework/batch/spring-batch-infrastructure/$RELEASE_VERSION
39-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-infrastructure/$RELEASE_VERSION/spring-batch-infrastructure-$RELEASE_VERSION.pom
40-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-infrastructure/$RELEASE_VERSION/spring-batch-infrastructure-$RELEASE_VERSION.jar
41-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-infrastructure/$RELEASE_VERSION/spring-batch-infrastructure-$RELEASE_VERSION-javadoc.jar
42-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-infrastructure/$RELEASE_VERSION/spring-batch-infrastructure-$RELEASE_VERSION-sources.jar
43-
44-
echo "Downloading core artifacts"
45-
cd ../../../../../..
46-
cd nexus/org/springframework/batch/spring-batch-core/$RELEASE_VERSION
47-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-core/$RELEASE_VERSION/spring-batch-core-$RELEASE_VERSION.pom
48-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-core/$RELEASE_VERSION/spring-batch-core-$RELEASE_VERSION.jar
49-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-core/$RELEASE_VERSION/spring-batch-core-$RELEASE_VERSION-javadoc.jar
50-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-core/$RELEASE_VERSION/spring-batch-core-$RELEASE_VERSION-sources.jar
51-
52-
echo "Downloading test artifacts"
53-
cd ../../../../../..
54-
cd nexus/org/springframework/batch/spring-batch-test/$RELEASE_VERSION
55-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-test/$RELEASE_VERSION/spring-batch-test-$RELEASE_VERSION.pom
56-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-test/$RELEASE_VERSION/spring-batch-test-$RELEASE_VERSION.jar
57-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-test/$RELEASE_VERSION/spring-batch-test-$RELEASE_VERSION-javadoc.jar
58-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-test/$RELEASE_VERSION/spring-batch-test-$RELEASE_VERSION-sources.jar
59-
60-
echo "Downloading integration artifacts"
61-
cd ../../../../../..
62-
cd nexus/org/springframework/batch/spring-batch-integration/$RELEASE_VERSION
63-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-integration/$RELEASE_VERSION/spring-batch-integration-$RELEASE_VERSION.pom
64-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-integration/$RELEASE_VERSION/spring-batch-integration-$RELEASE_VERSION.jar
65-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-integration/$RELEASE_VERSION/spring-batch-integration-$RELEASE_VERSION-javadoc.jar
66-
wget --user="$ARTIFACTORY_USERNAME" --password="$ARTIFACTORY_PASSWORD" $ARTIFACTORY_URL/spring-batch-integration/$RELEASE_VERSION/spring-batch-integration-$RELEASE_VERSION-sources.jar
67-
68-
- name: Sign artifacts and release them to Maven Central
69-
uses: jvalkeal/nexus-sync@v0
70-
id: nexus
23+
JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}
24+
- name: Download Release Artifacts
25+
shell: bash
26+
run: jf rt download --spec .github/release-files-spec.json --spec-vars 'buildname=${{ github.event.inputs.buildName }};buildnumber=${{ github.event.inputs.buildNumber }}'
27+
- name: Sync to Maven Central
28+
uses: spring-io/central-publish-action@0cdd90d12e6876341e82860d951e1bcddc1e51b6 # v0.2.0
7129
with:
72-
url: ${{ secrets.OSSRH_URL }}
73-
username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}
74-
password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}
75-
staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }}
76-
create: true
77-
upload: true
78-
close: true
79-
release: true
80-
generate-checksums: true
81-
pgp-sign: true
82-
pgp-sign-passphrase: ${{ secrets.GPG_PASSPHRASE }}
83-
pgp-sign-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
30+
token-name: ${{ secrets.CENTRAL_TOKEN_USERNAME }}
31+
token: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
32+
timeout: 60m

pom.xml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -364,21 +364,6 @@
364364
</plugins>
365365
</build>
366366

367-
<profiles>
368-
<profile>
369-
<id>artifactory-staging</id>
370-
<distributionManagement>
371-
<repository>
372-
<id>spring-staging</id>
373-
<url>https://repo.spring.io/libs-staging-local</url>
374-
<snapshots>
375-
<enabled>false</enabled>
376-
</snapshots>
377-
</repository>
378-
</distributionManagement>
379-
</profile>
380-
</profiles>
381-
382367
<repositories>
383368
<repository>
384369
<id>maven-central</id>

settings.xml

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)