|
35 | 35 | runjobs: ${{ steps.continue.outputs.runjobs }} |
36 | 36 | project_version: ${{ steps.continue.outputs.project_version }} |
37 | 37 | boot_version: ${{ steps.continue.outputs.boot_version }} |
| 38 | + should_deploy_artifacts: ${{ steps.should-deploy-artifacts.outputs.result }} |
38 | 39 | steps: |
39 | 40 | - uses: actions/checkout@v4 |
40 | 41 | - id: continue |
|
47 | 48 | echo "project_version=$version" >>$GITHUB_OUTPUT |
48 | 49 | bootVersion=$(cat gradle/libs.versions.toml | grep "spring-boot = \"" | cut -d '"' -f2) |
49 | 50 | echo "boot_version=$bootVersion" >>$GITHUB_OUTPUT |
| 51 | + - id: should-deploy-artifacts |
| 52 | + name: Check Deploy Artifacts using Secrets |
| 53 | + if: ${{ runner.os == 'Linux' }} |
| 54 | + run: | |
| 55 | + if [[ -z "$ARTIFACTORY_PASSWORD" ]] ; then |
| 56 | + echo "result=false" >> $GITHUB_OUTPUT |
| 57 | + else |
| 58 | + echo "result=true" >> $GITHUB_OUTPUT |
| 59 | + fi |
50 | 60 | build_jdk_17: |
51 | 61 | name: Build (JDK 17) |
52 | 62 | needs: [prerequisites] |
@@ -97,28 +107,20 @@ jobs: |
97 | 107 | -PspringBootVersion="$BOOT_VERSION" \ |
98 | 108 | -PsampleTests \ |
99 | 109 | :runAllSampleTests |
| 110 | +
|
100 | 111 | scan: |
101 | 112 | needs: [prerequisites] |
102 | 113 | if: ${{ needs.prerequisites.outputs.runjobs && !contains(inputs.run-trivy-scan, 'false') }} |
103 | 114 | uses: ./.github/workflows/trivy-scan.yml |
104 | 115 | deploy_artifacts: |
105 | 116 | name: Deploy Artifacts |
106 | 117 | needs: [build_jdk_17, check_samples, scan] |
107 | | - runs-on: ubuntu-latest |
108 | | - steps: |
109 | | - - uses: actions/checkout@v4 |
110 | | - - uses: spring-io/spring-gradle-build-action@v2 |
111 | | - - name: Deploy artifacts |
112 | | - env: |
113 | | - ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }} |
114 | | - ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }} |
115 | | - OSSRH_TOKEN_USERNAME: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} |
116 | | - OSSRH_TOKEN_PASSWORD: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} |
117 | | - run: | |
118 | | - ./gradlew publishArtifacts finalizeDeployArtifacts \ |
119 | | - --stacktrace \ |
120 | | - -PossrhUsername="$OSSRH_TOKEN_USERNAME" -PossrhPassword="$OSSRH_TOKEN_PASSWORD" \ |
121 | | - -PartifactoryUsername="$ARTIFACTORY_USERNAME" -PartifactoryPassword="$ARTIFACTORY_PASSWORD" |
| 118 | + uses: spring-io/spring-security-release-tools/.github/workflows/deploy-artifacts.yml@v1 |
| 119 | + with: |
| 120 | + should-deploy-artifacts: ${{ needs.prerequisites.outputs.should_deploy_artifacts }} |
| 121 | + default-publish-milestones-central: true |
| 122 | + secrets: inherit |
| 123 | + |
122 | 124 | deploy_docs_antora: |
123 | 125 | name: Deploy Antora Docs |
124 | 126 | needs: [build_jdk_17, check_samples, scan] |
@@ -155,31 +157,39 @@ jobs: |
155 | 157 | REPO: ${{ github.repository }} |
156 | 158 | BRANCH: ${{ github.ref_name }} |
157 | 159 | VERSION: ${{ needs.prerequisites.outputs.project_version }} |
| 160 | + TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} |
| 161 | + MILESTONE_REPO: https://repo1.maven.org/maven2 |
| 162 | + RELEASE_REPO: https://repo1.maven.org/maven2 |
| 163 | + ARTIFACT_PATH: org/springframework/pulsar/spring-pulsar |
158 | 164 | steps: |
159 | 165 | - uses: actions/checkout@v4 |
160 | 166 | with: |
161 | 167 | token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} |
162 | 168 | - uses: spring-io/spring-gradle-build-action@v2 |
163 | | - - name: Wait for Artifactory artifacts (milestone) |
| 169 | + - name: Wait for Milestone Artifacts |
164 | 170 | if: ${{ contains(needs.prerequisites.outputs.project_version, '-RC') || contains(needs.prerequisites.outputs.project_version, '-M') }} |
| 171 | + env: |
| 172 | + VERSION: ${{ needs.prerequisites.outputs.project_version }} |
165 | 173 | run: | |
166 | | - echo "Wait for artifacts of $REPO@$VERSION to appear on Artifactory." |
167 | | - until curl -f -s https://repo.spring.io/artifactory/milestone/org/springframework/pulsar/spring-pulsar/$VERSION/ > /dev/null |
| 174 | + echo "Wait for artifacts of $REPO@$VERSION to appear on milestone repository ($MILESTONE_REPO)." |
| 175 | + until curl -f -s $MILESTONE_REPO/$ARTIFACT_PATH/$VERSION/ > /dev/null |
168 | 176 | do |
169 | 177 | sleep 30 |
170 | 178 | echo "." |
171 | 179 | done |
172 | | - echo "Artifacts for $REPO@$VERSION have been released to Artifactory." |
173 | | - - name: Wait for Maven Central artifacts (GA) |
174 | | - if: ${{ !contains(needs.prerequisites.outputs.project_version, '-SNAPSHOT') && !contains(needs.prerequisites.outputs.project_version, '-RC') && !contains(needs.prerequisites.outputs.project_version, '-M') }} |
| 180 | + echo "Artifacts for $REPO@$VERSION have been released to milestone repository ($MILESTONE_REPO)." |
| 181 | + - name: Wait for Release Artifacts |
| 182 | + if: ${{ !contains(needs.prerequisites.outputs.project_version.version, '-RC') && !contains(needs.prerequisites.outputs.project_version, '-M') }} |
| 183 | + env: |
| 184 | + VERSION: ${{ needs.prerequisites.outputs.project_version }} |
175 | 185 | run: | |
176 | | - echo "Wait for artifacts of $REPO@$VERSION to appear on Maven Central." |
177 | | - until curl -f -s https://repo1.maven.org/maven2/org/springframework/pulsar/spring-pulsar/$VERSION/ > /dev/null |
| 186 | + echo "Wait for artifacts of $REPO@$VERSION to appear on release repository ($RELEASE_REPO)." |
| 187 | + until curl -f -s $RELEASE_REPO/$ARTIFACT_PATH/$VERSION/ > /dev/null |
178 | 188 | do |
179 | 189 | sleep 30 |
180 | 190 | echo "." |
181 | 191 | done |
182 | | - echo "Artifacts for $REPO@$VERSION have been released to Maven Central." |
| 192 | + echo "Artifacts for $REPO@$VERSION have been released to release repository ($RELEASE_REPO)." |
183 | 193 | - name: Setup git for release tagging |
184 | 194 | run: | |
185 | 195 | git config user.name 'github-actions[bot]' |
|
0 commit comments