|
33 | 33 | name: Promote
|
34 | 34 | runs-on: ubuntu-latest
|
35 | 35 | steps:
|
36 |
| - - name: Promote |
37 |
| - run: echo "Promote happens here" |
| 36 | + - name: Check Out |
| 37 | + uses: actions/checkout@v4 |
| 38 | + - name: Set Up JFrog CLI |
| 39 | + uses: jfrog/setup-jfrog-cli@7c95feb32008765e1b4e626b078dfd897c4340ad # v4.1.2 |
| 40 | + env: |
| 41 | + JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }} |
| 42 | + - name: Check Maven Central Sync Status |
| 43 | + id: check-sync-status |
| 44 | + run: | |
| 45 | + url=${{ format('https://repo.maven.apache.org/maven2/io/spring/javaformat/spring-javaformat/{0}/spring-javaformat-{0}.pom', inputs.version) }} |
| 46 | + status_code=$( curl --write-out '%{http_code}' --head --silent --output /dev/null ${url} ) |
| 47 | + if [ "${status_code}" != 200 ] && [ "${status_code}" != 404 ]; then |
| 48 | + echo "Unexpected status code ${status_code}" |
| 49 | + exit 1 |
| 50 | + fi |
| 51 | + echo "status-code=${status_code}" >> $GITHUB_OUTPUT |
| 52 | + - name: Download Release Artifacts |
| 53 | + if: ${{ steps.check-sync-status.outputs.status-code == '404' }} |
| 54 | + run: jf rt download --spec ./.github/artifacts.spec --spec-vars 'buildName=${{ format('spring-javaformat-{0}', inputs.version) }};buildNumber=${{ inputs.build-number }}' |
| 55 | + - name: Sync to Maven Central |
| 56 | + if: ${{ steps.check-sync-status.outputs.status-code == '404' }} |
| 57 | + |
| 58 | + with: |
| 59 | + username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} |
| 60 | + password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} |
| 61 | + staging-profile-name: ${{ secrets.OSSRH_S01_STAGING_PROFILE }} |
| 62 | + create: true |
| 63 | + upload: true |
| 64 | + close: true |
| 65 | + release: true |
| 66 | + generate-checksums: true |
| 67 | + - name: Await Maven Central Sync |
| 68 | + if: ${{ steps.check-sync-status.outputs.status-code == '404' }} |
| 69 | + run: | |
| 70 | + url=${{ format('https://repo.maven.apache.org/maven2/io/spring/javaformat/spring-javaformat/{0}/spring-javaformat-{0}.pom', inputs.version) }} |
| 71 | + echo "Waiting for $url" |
| 72 | + until curl --fail --head --silent $url > /dev/null |
| 73 | + do |
| 74 | + echo "." |
| 75 | + sleep 60 |
| 76 | + done |
| 77 | + echo "$url is available" |
| 78 | + - name: Promote Build |
| 79 | + if: ${{ steps.check-sync-status.outputs.status-code == '404' }} |
| 80 | + run: jfrog rt build-promote ${{ format('spring-javaformat-{0}', inputs.version)}} ${{ inputs.build-number }} libs-release-local |
| 81 | + - name: Publish Eclipse Update Site |
| 82 | + uses: ./.github/actions/publish-eclipse-update-site |
| 83 | + with: |
| 84 | + version: ${{ inputs.version }} |
| 85 | + build-number: ${{ inputs.build-number }} |
| 86 | + artifactory-username: ${{ secrets.ARTIFACTORY_USERNAME }} |
| 87 | + artifactory-password: ${{ secrets.ARTIFACTORY_PASSWORD }} |
| 88 | + - name: Create GitHub Release |
| 89 | + uses: ./.github/actions/create-github-release |
| 90 | + with: |
| 91 | + milestone: ${{ inputs.version }} |
| 92 | + token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }} |
0 commit comments