| 
1 |  | -name: Release GA  | 
2 |  | -run-name: ${{ format('{0} ({1})', github.workflow, github.ref_name) }}  | 
 | 1 | +name: Release to Maven Central  | 
3 | 2 | 
 
  | 
4 | 3 | on:  | 
5 | 4 |   workflow_dispatch:  | 
 | 5 | +    inputs:  | 
 | 6 | +      buildName:  | 
 | 7 | +        description: "Artifactory build name"  | 
 | 8 | +        required: true  | 
 | 9 | +      buildNumber:  | 
 | 10 | +        description: "Artifactory build number"  | 
 | 11 | +        required: true  | 
6 | 12 | 
 
  | 
7 | 13 | jobs:  | 
8 |  | -  staging:  | 
9 |  | -    runs-on: ubuntu-latest  | 
10 |  | -    outputs:  | 
11 |  | -      project-version: ${{ steps.output.outputs.project-version }}  | 
12 |  | -    steps:  | 
13 |  | -    - uses: actions/checkout@v3  | 
14 |  | -    - uses: actions/setup-java@v3  | 
15 |  | -      with:  | 
16 |  | -        distribution: adopt  | 
17 |  | -        java-version: |  | 
18 |  | -          22  | 
19 |  | -          17  | 
20 |  | -    - uses: jfrog/setup-jfrog-cli@v3  | 
21 |  | -      env:  | 
22 |  | -        JF_URL: 'https://repo.spring.io'  | 
23 |  | -        JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}  | 
24 |  | -    - name: Configure JFrog Cli  | 
25 |  | -      run: |  | 
26 |  | -        jf gradlec \  | 
27 |  | -          --use-wrapper \  | 
28 |  | -          --uses-plugin \  | 
29 |  | -          --deploy-ivy-desc=false \  | 
30 |  | -          --server-id-resolve=${{ vars.JF_SERVER_ID }} \  | 
31 |  | -          --server-id-deploy=${{ vars.JF_SERVER_ID }} \  | 
32 |  | -          --repo-resolve release \  | 
33 |  | -          --repo-deploy libs-staging-local  | 
34 |  | -        echo JFROG_CLI_BUILD_NAME=spring-shell-main-release >> $GITHUB_ENV  | 
35 |  | -        echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV  | 
36 |  | -    - name: Configure Release Version  | 
37 |  | -      run: |  | 
38 |  | -        snapshotVersion=$( awk -F '=' '$1 == "version" { print $2 }' gradle.properties )  | 
39 |  | -        plainVersion=${snapshotVersion%-SNAPSHOT}  | 
40 |  | -        sed -i "s/version=$snapshotVersion/version=$plainVersion/" gradle.properties  | 
41 |  | -        echo PROJECT_VERSION=$plainVersion >> $GITHUB_ENV  | 
42 |  | -    - name: Tag Release  | 
43 |  | -      env:  | 
44 |  | -        PROJECT_VERSION: ${{ env.PROJECT_VERSION }}  | 
45 |  | -      run: |  | 
46 |  | -        git config --global user.name github-actions[bot]  | 
47 |  | -        git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com  | 
48 |  | -        git checkout -b $PROJECT_VERSION  | 
49 |  | -        git commit -a -m "Release $PROJECT_VERSION"  | 
50 |  | -        git tag "v$PROJECT_VERSION"  | 
51 |  | -    - name: Build and Publish  | 
52 |  | -      env:  | 
53 |  | -        DISABLE_SAMPLES: true  | 
54 |  | -        ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY }}  | 
55 |  | -        ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }}  | 
56 |  | -        GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}  | 
57 |  | -        GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}  | 
58 |  | -        GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}  | 
59 |  | -      run: |  | 
60 |  | -        jf gradle build artifactoryPublish  | 
61 |  | -        jf rt build-publish  | 
62 |  | -    - name: Push Release  | 
63 |  | -      env:  | 
64 |  | -        PROJECT_VERSION: ${{ env.PROJECT_VERSION }}  | 
65 |  | -      run: |  | 
66 |  | -        git push origin $PROJECT_VERSION  | 
67 |  | -        git push --tags origin  | 
68 |  | -    - name: Output  | 
69 |  | -      id: output  | 
70 |  | -      env:  | 
71 |  | -        PROJECT_VERSION: ${{ env.PROJECT_VERSION }}  | 
72 |  | -      run: |  | 
73 |  | -        echo "project-version=$PROJECT_VERSION" >> $GITHUB_OUTPUT  | 
74 |  | -
  | 
75 |  | -  promote:  | 
76 |  | -    runs-on: ubuntu-latest  | 
77 |  | -    needs: staging  | 
78 |  | -    environment: promote  | 
79 |  | -    steps:  | 
80 |  | -    - uses: actions/checkout@v3  | 
81 |  | -    - uses: jfrog/setup-jfrog-cli@v3  | 
82 |  | -      env:  | 
83 |  | -        JF_URL: 'https://repo.spring.io'  | 
84 |  | -        JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}  | 
85 |  | -    - name: Configure JFrog Cli  | 
86 |  | -      run: |  | 
87 |  | -        echo JFROG_CLI_BUILD_NAME=spring-shell-main-release >> $GITHUB_ENV  | 
88 |  | -        echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV  | 
89 |  | -    - name: Promote Build  | 
90 |  | -      run: |  | 
91 |  | -        jf rt build-promote libs-release-local  | 
92 |  | -
  | 
93 |  | -  ghrelease:  | 
94 |  | -    runs-on: ubuntu-latest  | 
95 |  | -    needs: [staging, promote]  | 
96 |  | -    steps:  | 
97 |  | -    - uses: actions/checkout@v3  | 
98 |  | -    - name: Install Tooling  | 
99 |  | -      run: |  | 
100 |  | -        curl -sSL https://github.com/cbroglie/mustache/releases/download/v1.2.2/mustache_1.2.2_linux_amd64.tar.gz | sudo tar -C /usr/local/bin/ --no-same-owner -xzv mustache  | 
101 |  | -    - name: GitHub Release  | 
102 |  | -      env:  | 
103 |  | -        PROJECT_VERSION: ${{needs.staging.outputs.project-version}}  | 
104 |  | -        GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}  | 
105 |  | -        RELEASE_NOTES_FILE: ${{runner.temp}}/release_notes.md5  | 
106 |  | -        RELEASE_NOTES_DATA: ${{runner.temp}}/release_notes_data.json  | 
107 |  | -        RELEASE_NOTES_HEADERS: ${{runner.temp}}/release_notes_headers.json  | 
108 |  | -        RELEASE_NOTES_FOOTERS: ${{runner.temp}}/release_notes_footers.json  | 
109 |  | -        RELEASE_NOTES_ISSUES: ${{runner.temp}}/release_notes_issues.json  | 
110 |  | -        RELEASE_NOTES_PRS: ${{runner.temp}}/release_notes_prs.json  | 
111 |  | -      run: |  | 
112 |  | -        gh issue list \  | 
113 |  | -          --repo spring-projects/spring-shell \  | 
114 |  | -          --search milestone:$PROJECT_VERSION \  | 
115 |  | -          --label automation/rlnotes-header  \  | 
116 |  | -          --state all --json title,body \  | 
117 |  | -          --jq '{headers:map(.),headerslength:(length)}' \  | 
118 |  | -          > $RELEASE_NOTES_HEADERS  | 
119 |  | -        gh issue list \  | 
120 |  | -          --repo spring-projects/spring-shell \  | 
121 |  | -          --search milestone:$PROJECT_VERSION \  | 
122 |  | -          --label automation/rlnotes-footer  \  | 
123 |  | -          --state all --json title,body \  | 
124 |  | -          --jq '{footers:map(.),footerslength:(length)}' \  | 
125 |  | -          > $RELEASE_NOTES_FOOTERS  | 
126 |  | -        gh issue list \  | 
127 |  | -          --repo spring-projects/spring-shell \  | 
128 |  | -          --search milestone:$PROJECT_VERSION \  | 
129 |  | -          --state all --json number,title,labels \  | 
130 |  | -          --jq '{issues:map(select((.labels | length == 0) or (any(.labels[].name; startswith("automation/rlnotes")|not))))}' \  | 
131 |  | -          > $RELEASE_NOTES_ISSUES  | 
132 |  | -        gh pr list \  | 
133 |  | -          --repo spring-projects/spring-shell \  | 
134 |  | -          --search milestone:$PROJECT_VERSION \  | 
135 |  | -          --state all --json number,title,labels \  | 
136 |  | -          --jq '{prs:map(.),prslength:(length)}' \  | 
137 |  | -          > $RELEASE_NOTES_PRS  | 
138 |  | -        jq -s '{issues:(.[0].issues),prs:(.[1].prs),prslength:(.[1].prslength),headers:(.[2].headers),headerslength:(.[2].headerslength),footers:(.[3].footers), footerslength:(.[3].footerslength)}' \  | 
139 |  | -          $RELEASE_NOTES_ISSUES \  | 
140 |  | -          $RELEASE_NOTES_PRS \  | 
141 |  | -          $RELEASE_NOTES_HEADERS \  | 
142 |  | -          $RELEASE_NOTES_FOOTERS \  | 
143 |  | -          > $RELEASE_NOTES_DATA  | 
144 |  | -        mustache $RELEASE_NOTES_DATA .github/rlnotes.mustache > $RELEASE_NOTES_FILE  | 
145 |  | -        gh release create v$PROJECT_VERSION \  | 
146 |  | -          --draft \  | 
147 |  | -          --title "$PROJECT_VERSION" \  | 
148 |  | -          --notes-file $RELEASE_NOTES_FILE  | 
149 | 14 | 
 
  | 
150 |  | -  central:  | 
 | 15 | +  release:  | 
151 | 16 |     runs-on: ubuntu-latest  | 
152 |  | -    needs: ghrelease  | 
153 |  | -    environment: central  | 
154 | 17 |     steps:  | 
155 |  | -    - uses: actions/checkout@v3  | 
156 |  | -    - uses: jfrog/setup-jfrog-cli@v3  | 
157 |  | -      env:  | 
158 |  | -        JF_URL: 'https://repo.spring.io'  | 
159 |  | -        JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}  | 
160 |  | -    - name: Configure JFrog Cli  | 
161 |  | -      run: |  | 
162 |  | -        echo JFROG_CLI_BUILD_NAME=spring-shell-main-release >> $GITHUB_ENV  | 
163 |  | -        echo JFROG_CLI_BUILD_NUMBER=$GITHUB_RUN_NUMBER >> $GITHUB_ENV  | 
164 |  | -    - name: Download Release Files  | 
165 |  | -      run: |  | 
166 |  | -        jf rt download \  | 
167 |  | -          --spec .github/release-files-spec.json \  | 
168 |  | -          --spec-vars "buildname=$JFROG_CLI_BUILD_NAME;buildnumber=$JFROG_CLI_BUILD_NUMBER"  | 
169 |  | -    - uses: spring-io/nexus-sync-action@main  | 
170 |  | -      with:  | 
171 |  | -        username: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }}  | 
172 |  | -        password: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }}  | 
173 |  | -        staging-profile-name: ${{ secrets.OSSRH_STAGING_PROFILE_NAME }}  | 
174 |  | -        create: true  | 
175 |  | -        upload: true  | 
176 |  | -        close: true  | 
177 |  | -        close-timeout: 5400  | 
178 |  | -        release: true  | 
179 |  | -        release-timeout: 5400  | 
180 |  | -        generate-checksums: true  | 
 | 18 | + | 
 | 19 | +      - name: Set Up JFrog CLI  | 
 | 20 | +        uses: jfrog/setup-jfrog-cli@9fe0f98bd45b19e6e931d457f4e98f8f84461fb5 # v4.4.1  | 
 | 21 | +        env:  | 
 | 22 | +          JF_ENV_SPRING: ${{ secrets.JF_ARTIFACTORY_SPRING }}  | 
 | 23 | +      - name: Download Release Artifacts  | 
 | 24 | +        shell: bash  | 
 | 25 | +        run: jf rt download --spec .github/release-files-spec.json --spec-vars 'buildname=${{ github.event.inputs.buildName }};buildnumber=${{ github.event.inputs.buildNumber }}'  | 
 | 26 | +      - name: Sync to Maven Central  | 
 | 27 | +        uses: spring-io/central-publish-action@0cdd90d12e6876341e82860d951e1bcddc1e51b6 # v0.2.0  | 
 | 28 | +        with:  | 
 | 29 | +          token: ${{ secrets.CENTRAL_TOKEN_PASSWORD }}  | 
 | 30 | +          token-name: ${{ secrets.CENTRAL_TOKEN_USERNAME }}  | 
 | 31 | +          timeout: 60m  | 
0 commit comments