3131 runs-on : ubuntu-24.04
3232 outputs :
3333 release_version : ${{ steps.release_version.outputs.value }}
34+ extract_repository_name : ${{ steps.extract_repository_name.outputs.repository_name }}
3435 steps :
3536 - name : " Output Agent IP" # in the event RAO blocks this agent, this can be used to debug it
3637 run : curl -s https://api.ipify.org
38+ - name : " Extract repository name"
39+ id : extract_repository_name
40+ run : |
41+ echo "repository_name=${GITHUB_REPOSITORY##*/}" >> $GITHUB_OUTPUT
3742 - name : " 📥 Checkout repository"
3843 uses : actions/checkout@v4
3944 - name : ' Ensure Common Build Date' # to ensure a reproducible build
5156 uses : actions/setup-java@v4
5257 with :
5358 distribution : liberica
54- java-version : ' 17.0.14 ' # this must be a specific version for reproducible builds
59+ java-version : ' 17.0.15 ' # this must be a specific version for reproducible builds
5560 - name : " 🐘 Setup Gradle"
5661 uses : gradle/actions/setup-gradle@v4
5762 with :
@@ -70,12 +75,26 @@ jobs:
7075 NEXUS_PUBLISH_PASSWORD : ${{ secrets.NEXUS_STAGE_DEPLOYER_PW }}
7176 NEXUS_PUBLISH_URL : ' https://repository.apache.org/service/local/'
7277 NEXUS_PUBLISH_STAGING_PROFILE_ID : ${{ secrets.STAGING_PROFILE_ID }}
73- NEXUS_PUBLISH_DESCRIPTION : ' grails-spring-security :${{ steps.release_version.outputs.value }}'
78+ NEXUS_PUBLISH_DESCRIPTION : ' ${{ steps.extract_repository_name.outputs.repository_name }} :${{ steps.release_version.outputs.value }}'
7479 SIGNING_KEY : ${{ secrets.GPG_KEY_ID }}
7580 run : >
76- ./gradlew --refresh-dependencies
81+ ./gradlew
7782 publishToSonatype
7883 closeSonatypeStagingRepository
84+ aggregateChecksums
85+ aggregatePublishedArtifacts
86+ - name : " Upload checksums"
87+ uses : softprops/action-gh-release@v2
88+ with :
89+ files : build/CHECKSUMS.txt
90+ env :
91+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
92+ - name : " Upload published artifacts"
93+ uses : softprops/action-gh-release@v2
94+ with :
95+ files : build/PUBLISHED_ARTIFACTS.txt
96+ env :
97+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
7998 - name : " Generate Build Date file"
8099 run : echo "$SOURCE_DATE_EPOCH" >> build/BUILD_DATE.txt
81100 - name : " Upload Build Date file"
@@ -84,6 +103,133 @@ jobs:
84103 files : build/BUILD_DATE.txt
85104 env :
86105 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
106+ source :
107+ # to ensure we never publish any build artifacts, run the source distribution as a separate build workflow
108+ environment : source
109+ name : " Source Distribution"
110+ needs : publish
111+ permissions :
112+ contents : write
113+ runs-on : ubuntu-latest
114+ outputs :
115+ extract_repository_name : ${{ steps.extract_repository_name.outputs.repository_name }}
116+ steps :
117+ - name : " Extract repository name"
118+ id : extract_repository_name
119+ run : |
120+ echo "repository_name=${GITHUB_REPOSITORY##*/}" >> $GITHUB_OUTPUT
121+ - name : " 📥 Checkout repository"
122+ uses : actions/checkout@v4
123+ with :
124+ repository : ${{ github.repository }}
125+ ref : ${{ github.ref_name }}
126+ path : project
127+ - name : " 🗑️ Remove unnecessary files"
128+ run : |
129+ rm -f project/gradle/wrapper/gradle-wrapper.jar
130+ rm -f project/gradle/wrapper/gradle-wrapper.properties
131+ rm -f project/gradlew
132+ rm -f project/.asf.yaml
133+ - name : " Download CHECKSUMS.txt and rename to CHECKSUMS"
134+ env :
135+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
136+ run : |
137+ cd project
138+ release_url=$(gh release view ${{ github.ref_name }} --json assets --repo ${{ github.repository }} --jq '.assets[] | select(.name == "CHECKSUMS.txt") | .url')
139+ curl -L -H "Authorization: token $GH_TOKEN" -o CHECKSUMS "$release_url"
140+ - name : " Download PUBLISHED_ARTIFACTS.txt and rename to PUBLISHED_ARTIFACTS"
141+ env :
142+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
143+ run : |
144+ cd project
145+ release_url=$(gh release view ${{ github.ref_name }} --json assets --repo ${{ github.repository }} --jq '.assets[] | select(.name == "PUBLISHED_ARTIFACTS.txt") | .url')
146+ curl -L -H "Authorization: token $GH_TOKEN" -o PUBLISHED_ARTIFACTS "$release_url"
147+ - name : " Download BUILD_DATE.txt and rename to BUILD_DATE"
148+ env :
149+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
150+ run : |
151+ cd project
152+ release_url=$(gh release view ${{ github.ref_name }} --json assets --repo ${{ github.repository }} --jq '.assets[] | select(.name == "BUILD_DATE.txt") | .url')
153+ curl -L -H "Authorization: token $GH_TOKEN" -o BUILD_DATE "$release_url"
154+ - name : " Ensure source files use common date"
155+ run : |
156+ SOURCE_DATE_EPOCH=$(cat project/BUILD_DATE)
157+ find . -depth \( -type f -o -type d \) -exec touch -d "@${SOURCE_DATE_EPOCH}" {} +
158+ - name : " 📦 Create source distribution ZIP"
159+ run : |
160+ version="${{ github.ref_name }}"
161+ version="${version#v}" # Strip 'v' prefix
162+ zip -r "apache-${{ steps.extract_repository_name.outputs.repository_name }}-${version}-incubating-src.zip" project -x 'project/.git/*' -x 'project/.github/*'
163+ - name : ' 🔐 Set up GPG'
164+ run : |
165+ echo "${{ secrets.GRAILS_GPG_KEY }}" | gpg --batch --import
166+ gpg --list-keys
167+ env :
168+ GPG_KEY_ID : ${{ secrets.GPG_KEY_ID }}
169+ - name : " 🔏 Sign source distribution ZIP"
170+ env :
171+ GPG_KEY_ID : ${{ secrets.GPG_KEY_ID }}
172+ run : |
173+ version="${{ github.ref_name }}"
174+ version="${version#v}" # Strip 'v' prefix
175+ gpg --default-key "${GPG_KEY_ID}" --batch --yes --pinentry-mode loopback --armor --detach-sign apache-${{ steps.extract_repository_name.outputs.repository_name }}-${version}-incubating-src.zip
176+ - name : " 📦 Create source distribution checksum"
177+ run : |
178+ version="${{ github.ref_name }}"
179+ version="${version#v}" # Strip 'v' prefix
180+ sha512sum apache-${{ steps.extract_repository_name.outputs.repository_name }}-${version}-incubating-src.zip > "apache-${{ steps.extract_repository_name.outputs.repository_name }}-${version}-incubating-src.zip.sha512"
181+ - name : " 🚀 Upload ZIP and Signature to GitHub Release"
182+ uses : softprops/action-gh-release@v2
183+ with :
184+ tag_name : ${{ github.ref_name }}
185+ files : |
186+ apache-${{ steps.extract_repository_name.outputs.repository_name }}-*-incubating-src.zip
187+ apache-${{ steps.extract_repository_name.outputs.repository_name }}-*-incubating-src.zip.sha512
188+ apache-${{ steps.extract_repository_name.outputs.repository_name }}-*-incubating-src.zip.asc
189+ - name : " Remove CHECKSUMS.txt asset from release"
190+ env :
191+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
192+ run : |
193+ set -e
194+ cd project
195+ gh release --repo ${{ github.repository }} delete-asset ${{ github.ref_name }} CHECKSUMS.txt --yes
196+ - name : " Remove BUILD_DATE.txt asset from release"
197+ env :
198+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
199+ run : |
200+ set -e
201+ cd project
202+ gh release --repo ${{ github.repository }} delete-asset ${{ github.ref_name }} BUILD_DATE.txt --yes
203+ - name : " Remove PUBLISHED_ARTIFACTS.txt asset from release"
204+ env :
205+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
206+ run : |
207+ set -e
208+ cd project
209+ gh release --repo ${{ github.repository }} delete-asset ${{ github.ref_name }} PUBLISHED_ARTIFACTS.txt --yes
210+ release :
211+ environment : release
212+ needs : [publish, source]
213+ runs-on : ubuntu-latest
214+ permissions :
215+ contents : write
216+ issues : write
217+ steps :
218+ - name : " 📥 Checkout repository"
219+ uses : actions/checkout@v4
220+ with :
221+ ref : v${{ needs.publish.outputs.release_version }}
222+ - name : " ☕️ Setup JDK"
223+ uses : actions/setup-java@v4
224+ with :
225+ distribution : liberica
226+ java-version : ' 17.0.15' # this must be a specific version for reproducible builds
227+ - name : " 🐘 Setup Gradle"
228+ uses : gradle/actions/setup-gradle@v4
229+ with :
230+ develocity-access-key : ${{ secrets.GRAILS_DEVELOCITY_ACCESS_KEY }}
231+ - name : " ⚙️ Run post-release"
232+ uses : apache/grails-github-actions/post-release@asf
87233 docs :
88234 environment : docs
89235 name : " Publish Documentation"
@@ -97,12 +243,10 @@ jobs:
97243 uses : actions/checkout@v4
98244 with :
99245 ref : v${{ needs.publish.outputs.release_version }}
100- - name : ' Ensure Common Build Date' # to ensure a reproducible build
101- run : echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> "$GITHUB_ENV"
102246 - name : " ☕️ Setup JDK"
103247 uses : actions/setup-java@v4
104248 with :
105- java-version : 17
249+ java-version : ' 17.0.15 ' # this must be a specific version for reproducible builds
106250 distribution : liberica
107251 - name : " 🐘 Setup Gradle"
108252 uses : gradle/actions/setup-gradle@v4
@@ -118,29 +262,4 @@ jobs:
118262 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
119263 GRADLE_PUBLISH_RELEASE : ' true'
120264 SOURCE_FOLDER : build/docs
121- VERSION : ${{ steps.release_version.outputs.value }}
122- release :
123- environment : release
124- needs : publish
125- runs-on : ubuntu-latest
126- permissions :
127- contents : write
128- issues : write
129- steps :
130- - name : " 📥 Checkout repository"
131- uses : actions/checkout@v4
132- with :
133- ref : v${{ needs.publish.outputs.release_version }}
134- - name : ' Ensure Common Build Date' # to ensure a reproducible build
135- run : echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> "$GITHUB_ENV"
136- - name : " ☕️ Setup JDK"
137- uses : actions/setup-java@v4
138- with :
139- distribution : liberica
140- java-version : 17
141- - name : " 🐘 Setup Gradle"
142- uses : gradle/actions/setup-gradle@v4
143- with :
144- develocity-access-key : ${{ secrets.GRAILS_DEVELOCITY_ACCESS_KEY }}
145- - name : " ⚙️ Run post-release"
146- uses : apache/grails-github-actions/post-release@asf
265+ VERSION : ${{ needs.publish.outputs.release_version }}
0 commit comments