Skip to content

Commit 865e942

Browse files
committed
Publish to Artifactory with spring-io/deploy-artifactory-action
The commits switches from the JFrog Gradle plugin to the spring-io/deploy-artifactory-action to publish artifacts to Artifactory. Also adds `forceLocalPublish` property to allow docs to be AdHoc published to repair the botched `2.0.0` release (missing its docs). See #1330 Signed-off-by: onobc <[email protected]>
1 parent 806532c commit 865e942

File tree

3 files changed

+122
-29
lines changed

3 files changed

+122
-29
lines changed

.github/workflows/ci.yml

Lines changed: 34 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -127,21 +127,25 @@ jobs:
127127
fi
128128
echo "deploy_location=$deploy_location" >> $GITHUB_OUTPUT
129129
130-
- name: Publish Artifacts to Artifactory
130+
- name: Stage Local Artifacts for Publishing to Artifactory
131131
if: ${{ steps.deploy-location.outputs.deploy_location == 'artifactory' }}
132-
env:
133-
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}
134-
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }}
135-
ARTIFACTORY_BUILD_NAME: ${{ github.event.repository.name }}-${{ steps.branch-name.outputs.branch }}
136-
ARTIFACTORY_BUILD_NUMBER: ${{ github.run_id }}
137-
ARTIFACTORY_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
138-
ARTIFACTORY_USER_AGENT_NAME: GitHub Actions
139-
ARTIFACTORY_USER_AGENT_VERSION: Unknown
140-
ARTIFACTORY_VCS_REVISION: ${{ github.sha }}
132+
shell: bash
141133
run: |
142-
./gradlew artifactoryPublish \
143-
--stacktrace \
144-
-PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD"
134+
./gradlew -PdeploymentRepository=$(pwd)/deployment-repository publishAllPublicationsToDeploymentRepository
135+
- name: Publish Staged Artifacts to Artifactory
136+
if: ${{ steps.deploy-location.outputs.deploy_location == 'artifactory' }}
137+
uses: spring-io/artifactory-deploy-action@dc1913008c0599f0c4b1fdafb6ff3c502b3565ea # v0.0.2
138+
with:
139+
artifact-properties: |
140+
/**/*docs-*.zip::zip.name=spring-pulsar,zip.type=docs,zip.deployed=false
141+
uri: 'https://repo.spring.io'
142+
repository: 'libs-snapshot-local'
143+
build-name: 'spring-pulsar-2.0.x'
144+
folder: 'deployment-repository'
145+
signing-key: ${{ secrets.GPG_PRIVATE_KEY }}
146+
signing-passphrase: ${{ secrets.GPG_PASSPHRASE }}
147+
username: ${{ secrets.ARTIFACTORY_USERNAME }}
148+
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
145149

146150
- name: Stage Local Artifacts for Publishing to Central
147151
if: ${{ steps.deploy-location.outputs.deploy_location == 'central' }}
@@ -153,7 +157,6 @@ jobs:
153157
# rm checksums to work around https://github.com/spring-io/central-publish-action/issues/11
154158
find -name "*.md5" | xargs rm -f
155159
find -name "*.sha*" | xargs rm -f
156-
157160
- name: Publish Staged Artifacts to Central
158161
if: ${{ steps.deploy-location.outputs.deploy_location == 'central' }}
159162
uses: spring-io/central-publish-action@0c03960e9b16fdfe70e2443e1d5393cbc3a35622 # v0.3.0
@@ -162,21 +165,25 @@ jobs:
162165
token: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}
163166
dir: build/publications/repos
164167

165-
- name: Still publish docs module to Artifactory when deploy location is Central
168+
- name: Still publish docs module to Artifactory when deploy location is Central (stage)
166169
if: ${{ steps.deploy-location.outputs.deploy_location == 'central' }}
167-
env:
168-
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}
169-
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }}
170-
ARTIFACTORY_BUILD_NAME: ${{ github.event.repository.name }}-${{ steps.branch-name.outputs.branch }}
171-
ARTIFACTORY_BUILD_NUMBER: ${{ github.run_id }}
172-
ARTIFACTORY_BUILD_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
173-
ARTIFACTORY_USER_AGENT_NAME: GitHub Actions
174-
ARTIFACTORY_USER_AGENT_VERSION: Unknown
175-
ARTIFACTORY_VCS_REVISION: ${{ github.sha }}
170+
shell: bash
176171
run: |
177-
./gradlew :spring-pulsar-docs:artifactoryPublish \
178-
--stacktrace \
179-
-PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD"
172+
./gradlew -PdeploymentRepository=$(pwd)/deployment-repository :spring-pulsar-docs:publishAllPublicationsToDeploymentRepository
173+
- name: Still publish docs module to Artifactory when deploy location is Central (publish)
174+
if: ${{ steps.deploy-location.outputs.deploy_location == 'central' }}
175+
uses: spring-io/artifactory-deploy-action@dc1913008c0599f0c4b1fdafb6ff3c502b3565ea # v0.0.2
176+
with:
177+
artifact-properties: |
178+
/**/*docs-*.zip::zip.name=spring-pulsar,zip.type=docs,zip.deployed=false
179+
uri: 'https://repo.spring.io'
180+
repository: 'libs-release-local'
181+
build-name: 'spring-pulsar-2.0.x'
182+
folder: 'deployment-repository'
183+
signing-key: ${{ secrets.GPG_PRIVATE_KEY }}
184+
signing-passphrase: ${{ secrets.GPG_PASSPHRASE }}
185+
username: ${{ secrets.ARTIFACTORY_USERNAME }}
186+
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
180187

181188
deploy_docs_antora:
182189
name: Deploy Antora Docs
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Deploy Docs Ad Hoc
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branch-or-tag:
7+
description: 'Branch or tag name to deploy docs for (e.g. v2.0.0)'
8+
required: true
9+
type: string
10+
env:
11+
GCHAT_WEBHOOK_URL: ${{ secrets.SPRING_RELEASE_GCHAT_WEBHOOK_URL }}
12+
DEVELOCITY_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
13+
COMMIT_OWNER: ${{ github.event.pusher.name }}
14+
COMMIT_SHA: ${{ github.sha }}
15+
ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }}
16+
ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }}
17+
GH_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
18+
19+
jobs:
20+
deploy_docs_artifactory:
21+
name: Deploy Docs To Artifactory
22+
runs-on: ubuntu-latest
23+
if: github.repository == 'spring-projects/spring-pulsar'
24+
steps:
25+
- uses: actions/checkout@v5
26+
with:
27+
ref: ${{ inputs.branch-or-tag }}
28+
- uses: spring-io/spring-gradle-build-action@v2
29+
with:
30+
java-version: '25'
31+
distribution: 'liberica'
32+
- name: Stage Local spring-pulsar-docs Artifacts for Publishing to Artifactory
33+
id: stage-spring-pulsar-docs
34+
shell: bash
35+
run: |
36+
sed -i "s/version=2.0.1-SNAPSHOT/version=2.0.0/g" gradle.properties
37+
cat gradle.properties
38+
./gradlew \
39+
-PdeploymentRepository=$(pwd)/deployment-repository \
40+
-PforceLocalPublish=true \
41+
:spring-pulsar-docs:publishAllPublicationsToDeploymentRepository
42+
echo "deployRepo=$(pwd)/deployment-repository" >> $GITHUB_OUTPUT
43+
echo "ls -R $(pwd)/deployment-repository"
44+
ls -R $(pwd)/deployment-repository
45+
- name: Publish Staged spring-pulsar-docs to Artifactory
46+
uses: spring-io/artifactory-deploy-action@dc1913008c0599f0c4b1fdafb6ff3c502b3565ea # v0.0.2
47+
with:
48+
artifact-properties: |
49+
/**/*docs-*.zip::zip.name=spring-pulsar,zip.type=docs,zip.deployed=false
50+
uri: 'https://repo.spring.io'
51+
repository: 'libs-release-local'
52+
build-name: 'spring-pulsar-2.0.x'
53+
folder: 'deployment-repository'
54+
signing-key: ${{ secrets.GPG_PRIVATE_KEY }}
55+
signing-passphrase: ${{ secrets.GPG_PASSPHRASE }}
56+
username: ${{ secrets.ARTIFACTORY_USERNAME }}
57+
password: ${{ secrets.ARTIFACTORY_PASSWORD }}
58+
deploy_docs_antora:
59+
name: Deploy Antora Docs
60+
runs-on: ubuntu-latest
61+
if: github.repository == 'spring-projects/spring-pulsar'
62+
steps:
63+
- uses: actions/checkout@v5
64+
with:
65+
ref: ${{ inputs.branch-or-tag }}
66+
- uses: spring-io/spring-gradle-build-action@v2
67+
with:
68+
java-version: '25'
69+
distribution: 'liberica'
70+
- name: Run Antora
71+
run: |
72+
./gradlew antora
73+
- name: Publish Docs
74+
uses: spring-io/spring-doc-actions/[email protected]
75+
with:
76+
docs-username: ${{ secrets.DOCS_USERNAME }}
77+
docs-host: ${{ secrets.DOCS_HOST }}
78+
docs-ssh-key: ${{ secrets.DOCS_SSH_KEY }}
79+
docs-ssh-host-key: ${{ secrets.DOCS_SSH_HOST_KEY }}
80+
site-path: spring-pulsar-docs/build/site
81+
- name: Bust Clouflare Cache
82+
uses: spring-io/spring-doc-actions/[email protected]
83+
with:
84+
context-root: spring-pulsar
85+
cloudflare-zone-id: ${{ secrets.CLOUDFLARE_ZONE_ID }}
86+
cloudflare-cache-token: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}

spring-pulsar-docs/spring-pulsar-docs.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,9 @@ artifactoryPublish {
108108
}
109109

110110
tasks.withType(PublishToMavenRepository).configureEach {
111-
enabled = ProjectUtils.isSnapshot(project)
111+
enabled = ProjectUtils.isSnapshot(project) || project.hasProperty('forceLocalPublish')
112112
}
113113

114114
tasks.withType(PublishToMavenLocal).configureEach {
115-
enabled = ProjectUtils.isSnapshot(project)
115+
enabled = ProjectUtils.isSnapshot(project) || project.hasProperty('forceLocalPublish')
116116
}

0 commit comments

Comments
 (0)