This is an automated email from the ASF dual-hosted git repository. jamesfredley pushed a commit to branch build/release-process-from-core in repository https://gitbox.apache.org/repos/asf/grails-micronaut.git
commit 8bd9e78030c9b0f3488db069d8fb5bb951aa59d7 Author: James Fredley <[email protected]> AuthorDate: Sun Oct 18 10:58:23 2026 -0400 build: adopt the grails-core release and verification process Stage a signed source distribution to dist/dev and print the PMC vote email from the release workflow, gate post-vote steps behind the release, docs and close environments, and add verify.sh plus abort, drop-staging, close and verify-troubleshooting workflows. Trim LICENSE and NOTICE to what this repository actually distributes; the previous copies listed grails-core monorepo content that is not present here. Exclude the generated BUILD_DATE, CHECKSUMS and PUBLISHED_ARTIFACTS manifests from RAT so the source distribution passes its own audit. --- .github/scripts/dropStaging.sh | 40 +++++ .github/scripts/releaseDistributions.sh | 46 +++++ .github/scripts/releaseJarFiles.sh | 65 +++++++ .github/vote_templates/announce.txt | 41 +++++ .github/vote_templates/staged.txt | 57 ++++++ .github/vote_templates/vote_succeeded.txt | 27 +++ .github/workflows/release-abort.yml | 106 +++++++++++ .github/workflows/release-close.yml | 52 ++++++ .github/workflows/release-drop-staging.yml | 39 ++++ .github/workflows/release-verify.yml | 59 ++++++ .github/workflows/release.yml | 277 +++++++++++++++++++++++++++-- LICENSE | 53 ------ NOTICE | 48 +---- RELEASE.md | 195 ++++++++++++++------ etc/bin/download-release-artifacts.sh | 29 +++ etc/bin/reset-verify.sh | 35 ++++ etc/bin/verify-jar-artifacts.sh | 86 +++++++++ etc/bin/verify-keys.sh | 28 +++ etc/bin/verify-reproducible.sh | 50 ++++++ etc/bin/verify-source-distribution.sh | 57 ++++++ etc/bin/verify.sh | 55 ++++++ gradle/rat-root-config.gradle | 3 + 22 files changed, 1272 insertions(+), 176 deletions(-) diff --git a/.github/scripts/dropStaging.sh b/.github/scripts/dropStaging.sh new file mode 100755 index 0000000000..2338b181f8 --- /dev/null +++ b/.github/scripts/dropStaging.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail +if [[ $# != 2 || ( "$1" != --id && "$1" != --description ) ]]; then + echo "Usage: $0 <--id|--description> <value>" >&2 + exit 1 +fi +: "${NEXUS_STAGE_DEPLOYER_USER:?}" "${NEXUS_STAGE_DEPLOYER_PW:?}" "${STAGING_PROFILE_ID:?}" +repos=$(curl -fsS -u "$NEXUS_STAGE_DEPLOYER_USER:$NEXUS_STAGE_DEPLOYER_PW" -H 'Accept: application/json' \ + "https://repository.apache.org/service/local/staging/profile_repositories/$STAGING_PROFILE_ID") +matches=$(jq --arg mode "$1" --arg value "$2" \ + '[.data[] | select(if $mode == "--id" then .repositoryId == $value else .description == $value end)]' <<< "$repos") +count=$(jq length <<< "$matches") +if [[ "$count" == 0 && "$1" == --description ]]; then + echo "No staging repository found for $2. Nothing to drop." + exit 0 +fi +test "$count" = 1 +state=$(jq -r '.[0].type' <<< "$matches") +[[ "$state" == open || "$state" == closed ]] +id=$(jq -r '.[0].repositoryId' <<< "$matches") +payload=$(jq -n --arg id "$id" '{data:{stagedRepositoryIds:[$id],description:("Drop " + $id)}}') +curl -fsS -u "$NEXUS_STAGE_DEPLOYER_USER:$NEXUS_STAGE_DEPLOYER_PW" \ + -H 'Content-Type: application/json' -H 'Accept: application/json' \ + --data "$payload" https://repository.apache.org/service/local/staging/bulk/drop +echo "Successfully requested drop of repository $id." diff --git a/.github/scripts/releaseDistributions.sh b/.github/scripts/releaseDistributions.sh new file mode 100755 index 0000000000..d3b878fe31 --- /dev/null +++ b/.github/scripts/releaseDistributions.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail +if [[ $# != 3 ]]; then + echo "Usage: $0 <tag> <svn-folder: micronaut> <ASF username>" >&2 + exit 1 +fi +tag=$1 +folder=$2 +user=$3 +[[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-(M|RC)[0-9]+)?$ ]] +test "$folder" = micronaut +test -n "$user" +read -r -s -p 'ASF password: ' password +echo +test -n "$password" +version=${tag#v} +dev="https://dist.apache.org/repos/dist/dev/grails/$folder/$version" +root="https://dist.apache.org/repos/dist/release/grails/$folder" +flags=(--non-interactive --username "$user" --password "$password") +svn ls "${flags[@]}" "$dev/sources" +if svn ls "${flags[@]}" "$root/$version" >/dev/null 2>&1; then + echo 'Release destination already exists.' >&2 + exit 1 +fi +read -r -p "Has the 72-hour PMC vote passed? Promote $dev? [y/N] " confirm +[[ "$confirm" =~ ^[Yy](es)?$ ]] +if ! svn ls "${flags[@]}" "$root" >/dev/null 2>&1; then + svn mkdir "${flags[@]}" -m 'Create Grails Micronaut release folder' "$root" +fi +svn mv "${flags[@]}" -m "Promote Apache Grails Micronaut $version from dev to release" "$dev" "$root/$version" +echo 'Promoted. Remove superseded releases separately after checking the retention policy.' diff --git a/.github/scripts/releaseJarFiles.sh b/.github/scripts/releaseJarFiles.sh new file mode 100755 index 0000000000..93d7453797 --- /dev/null +++ b/.github/scripts/releaseJarFiles.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail +if [[ $# != 2 ]]; then + echo "Usage: $0 <staging-repo-description> <ASF username>" >&2 + exit 1 +fi +description=$1 +user=$2 +[[ "$description" =~ ^grails-micronaut:[0-9]+\.[0-9]+\.[0-9]+(-(M|RC)[0-9]+)?$ ]] +test -n "$user" +read -r -s -p 'ASF password: ' password +echo +test -n "$password" +nexusApi() { + local method=$1 path=$2 + shift 2 + curl -fsS -u "$user:$password" -H 'Accept: application/json' -H 'Content-Type: application/json' \ + -X "$method" "https://repository.apache.org/service/local$path" "$@" +} +repos=$(nexusApi GET /staging/profile_repositories) +matches=$(jq --arg d "$description" '[.data[] | select(.description == $d)]' <<< "$repos") +test "$(jq length <<< "$matches")" = 1 +id=$(jq -r '.[0].repositoryId' <<< "$matches") +profile=$(jq -r '.[0].profileId' <<< "$matches") +test "$(jq -r '.[0].type' <<< "$matches")" = closed +read -r -p "Has the 72-hour PMC vote passed? Release $id? [y/N] " confirm +[[ "$confirm" =~ ^[Yy](es)?$ ]] +payload=$(jq -n --arg id "$id" --arg d "$description" '{data:{stagedRepositoryId:$id,description:$d}}') +nexusApi POST "/staging/profiles/$profile/promote" --data "$payload" +started=$(date +%s) +while :; do + repos=$(nexusApi GET /staging/profile_repositories) + transitioning=$(jq -r --arg id "$id" '.data[] | select(.repositoryId == $id) | .transitioning' <<< "$repos") + state=$(jq -r --arg id "$id" '.data[] | select(.repositoryId == $id) | .type' <<< "$repos") + if [[ "$transitioning" == false && "$state" == released ]]; then + break + fi + if [[ "$transitioning" == false && "$state" != closed ]]; then + echo "Unexpected staging state '$state' for $id. Not dropping it." >&2 + nexusApi GET "/staging/repository/$id/activity" >&2 || true + exit 1 + fi + if (( $(date +%s) - started >= 600 )); then + echo 'Timed out waiting for promotion. Inspect Nexus activity before retrying.' >&2 + exit 1 + fi + sleep 3 +done +nexusApi POST "/staging/profiles/$profile/drop" --data "$payload" +echo "Released $id and requested staging repository cleanup." diff --git a/.github/vote_templates/announce.txt b/.github/vote_templates/announce.txt new file mode 100644 index 0000000000..08854d8a61 --- /dev/null +++ b/.github/vote_templates/announce.txt @@ -0,0 +1,41 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +The Apache Grails community is pleased to announce the release of ${PROJECT_NAME} ${VERSION}. + +${PROJECT_DESC} + +<IF MILESTONE> +This is a pre-release of a new version for ${PROJECT_NAME}. We greatly appreciate any feedback you can give us when using this version. +</IF MILESTONE> + +The release notes are available here: +https://github.com/${REPO_SLUG}/releases/tag/${TAG} + +For the complete list of changes: +https://github.com/${REPO_SLUG}/compare/v<PREVIOUS_VERSION>...${TAG} + +Source download: https://downloads.apache.org/grails/micronaut/${VERSION}/sources/ +Maven coordinates and usage: https://github.com/${REPO_SLUG}/blob/${TAG}/README.md + +Apache Grails website: https://grails.apache.org/ + +Grails Resources: +- Grails GitHub repo: https://github.com/${REPO_SLUG} +- Issues: https://github.com/${REPO_SLUG}/issues +- Mailing lists: https://grails.apache.org/community.html + +Happy Coding, +The Apache Grails Team diff --git a/.github/vote_templates/staged.txt b/.github/vote_templates/staged.txt new file mode 100644 index 0000000000..ee38ef181d --- /dev/null +++ b/.github/vote_templates/staged.txt @@ -0,0 +1,57 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +Hi Everyone, + +I am happy to start the VOTE thread to release ${PROJECT_NAME} ${VERSION}! + +Pre-release discussion thread is here: +<Thread Link> + +Release notes for the release are here: +https://github.com/${REPO_SLUG}/releases/tag/${TAG} + +The tag for this release is: +https://github.com/${REPO_SLUG}/releases/tag/${TAG} +Tag commit id: ${SHA} + +The artifacts to be voted on are located as follows (r${DIST_SVN_REVISION}): +Source release: https://dist.apache.org/repos/dist/dev/${SVN_PROJECT}/${SVN_FOLDER}/${VERSION}/sources + +Release artifacts are signed with a key from the following file: +https://dist.apache.org/repos/dist/release/grails/KEYS + +Please vote on releasing this package as: ${PROJECT_NAME} ${VERSION}. + +Reminder on ASF release approval requirements for PMC members: +https://www.apache.org/legal/release-policy.html#release-approval + +Hints on validating checksums/signatures (but replace md5sum with sha512sum): +https://www.apache.org/info/verification.html + +Details of our release process are documented at: https://github.com/apache/grails-micronaut/blob/HEAD/RELEASE.md + +As a reminder, most of our tools support an env `GRAILS_REPO_URL` so that the tools can work with staged artefacts. Set it to the staging repo like this: `export GRAILS_REPO_URL=https://repository.apache.org/content/groups/staging` + +The vote is open for a minimum of 72 hours and passes if a majority of at least +three +1 PMC votes are cast. + +[ ] +1 Release ${PROJECT_NAME} ${VERSION} +[ ] 0 I don't have a strong opinion about this, but I assume it's ok +[ ] -1 Do not release ${PROJECT_NAME} ${VERSION} because... + +Here is my vote: + ++1 (binding) diff --git a/.github/vote_templates/vote_succeeded.txt b/.github/vote_templates/vote_succeeded.txt new file mode 100644 index 0000000000..db7a384663 --- /dev/null +++ b/.github/vote_templates/vote_succeeded.txt @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +The vote has passed with <X> +1 binding votes and <Y> +1 additional votes. + +<IF NEW EMAIL> +Vote thread: <VOTE THREAD PERMALINK> +</IF NEW EMAIL> + +I'll proceed with the release and announce it shortly. + +Thanks to everyone who participated in the vote! + +Regards +<NAME> diff --git a/.github/workflows/release-abort.yml b/.github/workflows/release-abort.yml new file mode 100644 index 0000000000..cd38d8603e --- /dev/null +++ b/.github/workflows/release-abort.yml @@ -0,0 +1,106 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Release - Abort Release +on: + workflow_dispatch: + inputs: + release_tag: + description: 'Unpromoted pre-release tag (e.g. v8.0.0)' + required: true + type: string +permissions: {} +jobs: + abort: + environment: release + runs-on: ubuntu-24.04 + permissions: + contents: write + actions: write + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAG: ${{ inputs.release_tag }} + steps: + - name: Validate unpromoted candidate + run: | + [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-(M|RC)[0-9]+)?$ ]] + gh release view "$TAG" --repo "$GITHUB_REPOSITORY" --json isPrerelease --jq '.isPrerelease' | grep -qx true + echo "VERSION=${TAG#v}" >> "$GITHUB_ENV" + - name: Checkout trusted operational scripts + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - name: Refuse to abort a promoted version + run: | + for url in \ + "https://repository.apache.org/content/repositories/releases/org/apache/grails/grails-micronaut/$VERSION/" \ + "https://dist.apache.org/repos/dist/release/grails/micronaut/$VERSION/"; do + code=$(curl -sS -o /dev/null -w '%{http_code}' "$url") + if [[ "$code" != 404 ]]; then + echo "$url returned HTTP $code. $VERSION may already be promoted; aborting nothing." >&2 + exit 1 + fi + done + - name: Cancel this candidate's release runs and wait for them to stop + run: | + active() { + gh run list --repo "$GITHUB_REPOSITORY" --workflow release.yml --branch "$TAG" --limit 100 --json databaseId,status --jq '.[] | select(.status != "completed") | .databaseId' + } + active > run-ids.txt + while read -r id; do + gh api --method POST "repos/$GITHUB_REPOSITORY/actions/runs/$id/cancel" + done < run-ids.txt + for _ in $(seq 1 90); do + remaining=$(active) + if [[ -z "$remaining" ]]; then + exit 0 + fi + sleep 10 + done + echo 'Release runs are still active after 15 minutes. No cleanup was performed.' >&2 + exit 1 + - name: Drop candidate staging repository + env: + NEXUS_STAGE_DEPLOYER_USER: ${{ secrets.NEXUS_STAGE_DEPLOYER_USER }} + NEXUS_STAGE_DEPLOYER_PW: ${{ secrets.NEXUS_STAGE_DEPLOYER_PW }} + STAGING_PROFILE_ID: ${{ secrets.STAGING_PROFILE_ID }} + run: .github/scripts/dropStaging.sh --description "${GITHUB_REPOSITORY##*/}:$VERSION" + - name: Install SVN + run: sudo apt-get update && sudo apt-get install -y subversion subversion-tools + - name: Remove only Micronaut development artifacts + env: + SVN_USERNAME: ${{ secrets.SVC_DIST_GRAILS_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVC_DIST_GRAILS_PASSWORD }} + run: | + url="https://dist.apache.org/repos/dist/dev/grails/micronaut/$VERSION" + status() { curl -sS -o /dev/null -w '%{http_code}' "$url/"; } + code=$(status) + case "$code" in + 200) + svnmucc --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive \ + -m "Remove Grails Micronaut dev version $VERSION" rm "$url" + code=$(status) + if [[ "$code" != 404 ]]; then + echo "$url returned HTTP $code after removal." >&2 + exit 1 + fi + ;; + 404) echo "No development artifacts at $url." ;; + *) echo "$url returned HTTP $code. Not deleting the release or tag." >&2; exit 1 ;; + esac + - name: Remove candidate release and tag + run: | + gh release delete "$TAG" --repo "$GITHUB_REPOSITORY" --cleanup-tag --yes + echo 'Reply [CANCEL][VOTE] to the vote thread if one was opened. Check that no pending Release run remains.' diff --git a/.github/workflows/release-close.yml b/.github/workflows/release-close.yml new file mode 100644 index 0000000000..26e02f13de --- /dev/null +++ b/.github/workflows/release-close.yml @@ -0,0 +1,52 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Release - Close +on: + workflow_dispatch: + inputs: + version: + description: 'Already promoted release version (e.g. 8.0.0)' + required: true + type: string +permissions: {} +env: + VERSION: ${{ inputs.version }} + TARGET_BRANCH: ${{ github.ref_name }} +jobs: + close: + environment: close + runs-on: ubuntu-24.04 + permissions: + contents: write + issues: write + pull-requests: write + actions: write + steps: + - name: Validate release and target + run: | + [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-(M|RC)[0-9]+)?$ ]] + IFS=. read -r major minor _ <<< "$VERSION" + test "$TARGET_BRANCH" = "$major.$minor.x" + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: v${{ inputs.version }} + fetch-depth: 0 + - name: Run post-release + uses: apache/grails-github-actions/post-release@asf + env: + RELEASE_VERSION: ${{ env.VERSION }} + - name: Merge-back reminder + run: echo 'Merge the merge-back PR with a merge commit, not squash or rebase. This workflow does not promote artifacts.' diff --git a/.github/workflows/release-drop-staging.yml b/.github/workflows/release-drop-staging.yml new file mode 100644 index 0000000000..cb4eba99bf --- /dev/null +++ b/.github/workflows/release-drop-staging.yml @@ -0,0 +1,39 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Release - Drop Nexus Staging +on: + workflow_dispatch: + inputs: + staging_repository_id: + description: 'Unpromoted staging repository ID (e.g. orgapachegrails-1000)' + required: true + type: string +permissions: {} +jobs: + drop: + environment: release + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + - name: Drop staging repository + env: + STAGING_REPOSITORY_ID: ${{ inputs.staging_repository_id }} + NEXUS_STAGE_DEPLOYER_USER: ${{ secrets.NEXUS_STAGE_DEPLOYER_USER }} + NEXUS_STAGE_DEPLOYER_PW: ${{ secrets.NEXUS_STAGE_DEPLOYER_PW }} + STAGING_PROFILE_ID: ${{ secrets.STAGING_PROFILE_ID }} + run: .github/scripts/dropStaging.sh --id "$STAGING_REPOSITORY_ID" diff --git a/.github/workflows/release-verify.yml b/.github/workflows/release-verify.yml new file mode 100644 index 0000000000..269f2c958d --- /dev/null +++ b/.github/workflows/release-verify.yml @@ -0,0 +1,59 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Release - Verify Troubleshooting +on: + workflow_dispatch: + inputs: + release_tag: + description: 'Release tag to verify (e.g. v8.0.0)' + required: true + type: string +permissions: {} +concurrency: + group: release-verify-${{ inputs.release_tag }} + cancel-in-progress: false +jobs: + verify: + runs-on: ubuntu-24.04 + timeout-minutes: 180 + steps: + - name: Checkout release tooling and pinned tool versions + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ inputs.release_tag }} + path: project + persist-credentials: false + - name: Read release JDK pin + id: java + run: | + pin=$(sed -n 's/^java=//p' project/.sdkmanrc) + test "${pin##*-}" = librca + echo "version=${pin%-*}" >> "$GITHUB_OUTPUT" + - uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0 + with: + distribution: liberica + java-version: ${{ steps.java.outputs.version }} + - uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 + with: + cache-disabled: true + - name: Add external wrapper and verification scripts to PATH + run: | + echo "$GITHUB_WORKSPACE/project" >> "$GITHUB_PATH" + echo "$GITHUB_WORKSPACE/project/etc/bin" >> "$GITHUB_PATH" + - name: Verify release + env: + RELEASE_TAG: ${{ inputs.release_tag }} + run: verify.sh "$RELEASE_TAG" "$GITHUB_WORKSPACE/grails-verify" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e172d6592c..6aa62918b3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,22 +22,55 @@ on: permissions: { } env: + DIST_NAME: apache-grails-micronaut + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GRAILS_PUBLISH_RELEASE: 'true' JAVA_DISTRIBUTION: liberica # Keep synced with .sdkmanrc and etc/bin/Dockerfile. JAVA_VERSION: 25.0.3 + PROJECT_NAME: Apache Grails Micronaut + PROJECT_DESC: > + Apache Grails Micronaut provides Micronaut integration for Grails applications + and BOMs for the supported Hibernate integrations. + REPO_NAME: ${{ github.event.repository.name }} + REPO_SLUG: ${{ github.repository }} + SVN_PROJECT: grails + SVN_FOLDER: micronaut TAG: ${{ github.event.release.tag_name }} + TARGET_BRANCH: ${{ github.event.release.target_commitish }} + +concurrency: + group: release-pipeline-${{ github.event.release.target_commitish }} + cancel-in-progress: false jobs: publish: + name: Stage JAR files runs-on: ubuntu-24.04 permissions: contents: write + env: + NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_STAGE_DEPLOYER_USER }} + NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_STAGE_DEPLOYER_PW }} + NEXUS_PUBLISH_URL: ${{ vars.STAGING_URL }} + NEXUS_PUBLISH_STAGING_PROFILE_ID: ${{ secrets.STAGING_PROFILE_ID }} steps: + - name: Establish release version + run: | + [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-(M|RC)[0-9]+)?$ ]] + echo "VERSION=${TAG#v}" >> "$GITHUB_ENV" + echo "NEXUS_PUBLISH_DESCRIPTION=${REPO_NAME}:${TAG#v}" >> "$GITHUB_ENV" - name: Checkout release tag uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 with: fetch-depth: 0 ref: ${{ github.event.release.tag_name }} + - name: Verify release branch + run: | + IFS=. read -r major minor _ <<< "$VERSION" + releaseBranch="${major}.${minor}.x" + test "${TARGET_BRANCH#refs/heads/}" = "$releaseBranch" + test "$(sed -n 's/^githubBranch=//p' gradle.properties)" = "$releaseBranch" - name: Store common build date run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> "$GITHUB_ENV" - name: Ensure source files use common date @@ -51,34 +84,37 @@ jobs: uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6.3.0 with: cache-provider: basic - develocity-access-key: ${{ secrets.DEVELOCITY_ACCESS_KEY }} - - name: Establish release version - run: echo "RELEASE_VERSION=${GITHUB_REF_NAME#v}" >> "$GITHUB_ENV" - - name: Build and test release - run: ./gradlew build rat -PprojectVersion=${RELEASE_VERSION} --no-build-cache - - name: Initialize staging repository + develocity-access-key: ${{ secrets.GRAILS_DEVELOCITY_ACCESS_KEY }} + - name: Run pre-release + uses: apache/grails-github-actions/pre-release@asf env: - GRAILS_PUBLISH_RELEASE: 'true' - NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_STAGE_DEPLOYER_USER }} - NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_STAGE_DEPLOYER_PW }} - NEXUS_PUBLISH_URL: ${{ vars.STAGING_URL }} - NEXUS_PUBLISH_STAGING_PROFILE_ID: ${{ secrets.STAGING_PROFILE_ID }} - run: ./gradlew initializeSonatypeStagingRepository -PprojectVersion=${RELEASE_VERSION} + RELEASE_VERSION: ${{ env.VERSION }} - name: Set up GPG env: GPG_KEY: ${{ secrets.GRAILS_GPG_KEY }} run: | echo "${GPG_KEY}" | gpg --batch --import gpg --list-keys + - name: Record release commit + id: release-commit + run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" + - name: Build and test release + env: + SIGNING_KEY: ${{ secrets.GPG_KEY_ID }} + run: ./gradlew build rat --no-build-cache + - name: Initialize staging repository + run: ./gradlew initializeSonatypeStagingRepository - name: Publish four Grails Micronaut artifacts env: - GRAILS_PUBLISH_RELEASE: 'true' - NEXUS_PUBLISH_USERNAME: ${{ secrets.NEXUS_STAGE_DEPLOYER_USER }} - NEXUS_PUBLISH_PASSWORD: ${{ secrets.NEXUS_STAGE_DEPLOYER_PW }} - NEXUS_PUBLISH_URL: ${{ vars.STAGING_URL }} - NEXUS_PUBLISH_STAGING_PROFILE_ID: ${{ secrets.STAGING_PROFILE_ID }} SIGNING_KEY: ${{ secrets.GPG_KEY_ID }} - run: ./gradlew publishToSonatype closeSonatypeStagingRepository aggregateChecksums aggregatePublishedArtifacts -PprojectVersion=${RELEASE_VERSION} --no-build-cache + run: > + ./gradlew -x initializeSonatypeStagingRepository + findSonatypeStagingRepository publishToSonatype + aggregateChecksums aggregatePublishedArtifacts --no-build-cache + - name: Close staging repository + run: > + ./gradlew -x initializeSonatypeStagingRepository + findSonatypeStagingRepository closeSonatypeStagingRepository - name: Generate build date file run: echo "$SOURCE_DATE_EPOCH" > build/BUILD_DATE.txt - name: Upload build date, checksums and published artifacts @@ -89,3 +125,208 @@ jobs: build/BUILD_DATE.txt build/CHECKSUMS.txt build/PUBLISHED_ARTIFACTS.txt + outputs: + sha: ${{ steps.release-commit.outputs.sha }} + + source: + name: Create source distribution + needs: publish + runs-on: ubuntu-24.04 + permissions: + contents: write + steps: + - name: Establish release version + run: echo "VERSION=${TAG#v}" >> "$GITHUB_ENV" + - name: Checkout the released commit + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ needs.publish.outputs.sha }} + path: grails-micronaut + persist-credentials: false + - name: Remove wrappers and files that must not ship + run: | + for root in grails-micronaut grails-micronaut/build-logic; do + rm -f "$root/gradle/wrapper/gradle-wrapper.jar" "$root/gradle/wrapper/gradle-wrapper.properties" + rm -f "$root/gradlew" "$root/gradlew.bat" + done + rm -rf grails-micronaut/.git grails-micronaut/.github grails-micronaut/.omo grails-micronaut/.worktrees grails-micronaut/.claude/worktrees + rm -f grails-micronaut/KEYS grails-micronaut/.mailmap + - name: Include verification manifests + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + for file in CHECKSUMS PUBLISHED_ARTIFACTS BUILD_DATE; do + gh release download "$TAG" --repo "$REPO_SLUG" --pattern "$file.txt" --dir . + mv "$file.txt" "grails-micronaut/$file" + done + - name: Ensure source files use common date + run: | + SOURCE_DATE_EPOCH=$(cat grails-micronaut/BUILD_DATE) + find . -depth \( -type f -o -type d \) -exec touch -d "@${SOURCE_DATE_EPOCH}" {} + + find . -depth -type l -exec touch -h -d "@${SOURCE_DATE_EPOCH}" {} + + - name: Create source ZIP + run: > + zip -yr "${DIST_NAME}-${VERSION}-src.zip" grails-micronaut + -x 'grails-micronaut/.git/*' -x 'grails-micronaut/.github/*' + -x 'grails-micronaut/.omo/*' -x 'grails-micronaut/.worktrees/*' + -x 'grails-micronaut/.claude/worktrees/*' + - name: Set up GPG + env: + GPG_KEY: ${{ secrets.GRAILS_GPG_KEY }} + run: echo "$GPG_KEY" | gpg --batch --import + - name: Sign and checksum source ZIP + env: + SIGNING_KEY: ${{ secrets.GPG_KEY_ID }} + run: | + gpg --default-key "$SIGNING_KEY" --batch --yes --pinentry-mode loopback --armor --detach-sign "${DIST_NAME}-${VERSION}-src.zip" + sha512sum "${DIST_NAME}-${VERSION}-src.zip" > "${DIST_NAME}-${VERSION}-src.zip.sha512" + - name: Upload signed source distribution + uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2 + with: + tag_name: ${{ env.TAG }} + fail_on_unmatched_files: true + files: | + ${{ env.DIST_NAME }}-${{ env.VERSION }}-src.zip + ${{ env.DIST_NAME }}-${{ env.VERSION }}-src.zip.asc + ${{ env.DIST_NAME }}-${{ env.VERSION }}-src.zip.sha512 + - name: Remove temporary release assets + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + for file in CHECKSUMS PUBLISHED_ARTIFACTS BUILD_DATE; do + gh release delete-asset "$TAG" "$file.txt" --repo "$REPO_SLUG" --yes + done + + upload: + name: Stage source distribution and print vote + needs: [publish, source] + runs-on: ubuntu-24.04 + permissions: + contents: write + env: + SVN_USERNAME: ${{ secrets.SVC_DIST_GRAILS_USERNAME }} + SVN_PASSWORD: ${{ secrets.SVC_DIST_GRAILS_PASSWORD }} + steps: + - name: Establish release version + run: echo "VERSION=${TAG#v}" >> "$GITHUB_ENV" + - name: Install tools + run: sudo apt-get update && sudo apt-get install -y subversion subversion-tools gettext-base + - name: Ensure development folder exists + run: | + for folder in "$SVN_PROJECT" "$SVN_PROJECT/$SVN_FOLDER"; do + url="https://dist.apache.org/repos/dist/dev/$folder" + if ! svn ls "$url" --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive; then + svnmucc --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive mkdir "$url" -m "Create $folder dev folder" + fi + done + - name: Checkout development repository + run: svn checkout --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive "https://dist.apache.org/repos/dist/dev/$SVN_PROJECT/$SVN_FOLDER" dev-repo + - name: Download signed source and stage it + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Never silently replace artifacts that voters may already be reviewing. + test ! -e "dev-repo/$VERSION" + mkdir -p "dev-repo/$VERSION/sources" + gh release download "$TAG" --repo "$REPO_SLUG" --pattern "${DIST_NAME}-${VERSION}-src.zip*" --dir "dev-repo/$VERSION/sources" + cd "dev-repo/$VERSION/sources" + sha512sum -c "${DIST_NAME}-${VERSION}-src.zip.sha512" + cd ../.. + svn add "$VERSION" + svn commit -m "Upload $PROJECT_NAME source distribution for $VERSION" --username "$SVN_USERNAME" --password "$SVN_PASSWORD" --non-interactive + svn info "$VERSION" > DIST_SVN_REVISION.txt + - name: Upload distribution SVN revision + uses: softprops/action-gh-release@3bb12739c298aeb8a4eeaf626c5b8d85266b0e65 # v2.6.2 + with: + tag_name: ${{ env.TAG }} + files: dev-repo/DIST_SVN_REVISION.txt + - name: Checkout release templates + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ needs.publish.outputs.sha }} + path: templates + persist-credentials: false + - name: Print PMC vote email + env: + SHA: ${{ needs.publish.outputs.sha }} + run: | + DIST_SVN_REVISION=$(awk '/Last Changed Rev:/ {print $4}' dev-repo/DIST_SVN_REVISION.txt) + export DIST_SVN_REVISION + + echo '::group::Grails PMC Vote Email' + echo 'To: [email protected]' + echo "Subject: [VOTE] Release ${PROJECT_NAME} ${VERSION}" + sed '/^#/d' templates/.github/vote_templates/staged.txt | envsubst + echo '::endgroup::' + + release: + name: VOTE SUCCEEDED - Release artifacts manually + environment: release + needs: [publish, source, upload] + runs-on: ubuntu-24.04 + steps: + - name: Establish release version + run: echo "VERSION=${TAG#v}" >> "$GITHUB_ENV" + - name: Checkout release + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ needs.publish.outputs.sha }} + persist-credentials: false + - name: Install template tools + run: sudo apt-get update && sudo apt-get install -y gettext-base + - name: Print result and manual promotion instructions + run: | + echo 'Confirm at least 72 hours and a successful Grails PMC vote before promotion.' + echo 'To: [email protected]' + echo "Subject: [RESULT][VOTE] ${PROJECT_NAME} ${VERSION}" + sed '/^#/d' .github/vote_templates/vote_succeeded.txt | envsubst + echo "Run .github/scripts/releaseJarFiles.sh ${REPO_NAME}:${VERSION} <ASF_USER>" + echo "Run .github/scripts/releaseDistributions.sh ${TAG} ${SVN_FOLDER} <ASF_USER>" + echo "Record MICRONAUT-${VERSION} at https://reporter.apache.org/addrelease.html?grails" + + announcement: + name: VOTE SUCCEEDED - Confirm publication and prepare announcement + environment: docs + needs: [publish, release] + runs-on: ubuntu-24.04 + steps: + - name: Establish release version + run: echo "VERSION=${TAG#v}" >> "$GITHUB_ENV" + - name: Checkout release + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ needs.publish.outputs.sha }} + persist-credentials: false + - name: Install template tools + run: sudo apt-get update && sudo apt-get install -y gettext-base + - name: Print announcement + run: | + echo 'Approve this checkpoint only after manual promotion and mirror availability.' + echo 'There is no separate documentation distribution or site deployment in this repository.' + echo 'Send from your @apache.org address after updating the release links.' + echo 'To: [email protected], [email protected], [email protected]' + echo "Subject: [ANNOUNCE] ${PROJECT_NAME} ${VERSION}" + sed '/^#/d' .github/vote_templates/announce.txt | envsubst + + close: + name: VOTE SUCCEEDED - Close release + environment: close + needs: [publish, release, announcement] + runs-on: ubuntu-24.04 + permissions: + contents: write + issues: write + pull-requests: write + actions: write + steps: + - name: Checkout release + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: ${{ needs.publish.outputs.sha }} + fetch-depth: 0 + - name: Run post-release + uses: apache/grails-github-actions/post-release@asf + env: + RELEASE_VERSION: ${{ env.TAG }} + - name: Merge-back reminder + run: echo 'Merge the merge-back PR with a merge commit, not squash or rebase, so the release tag enters maintenance history.' diff --git a/LICENSE b/LICENSE index 6a85097182..ff9ad4530f 100644 --- a/LICENSE +++ b/LICENSE @@ -200,56 +200,3 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - --------------------------------------------------------------------------- - -Public Domain - -The following classes within this product: - - org.grails.web.json.JSONArray - org.grails.web.json.JSONElement - org.grails.web.json.JSONException - org.grails.web.json.JSONObject - org.grails.web.json.JSONTokener - org.grails.web.json.JSONWriter - -Originally from https://github.com/stleary/JSON-java - --------------------------------------------------------------------------- - -The following files are licensed under the Eclipse Public License 2.0: - - grails-gsp/grails-web-jsp/src/main/resources/org/grails/gsp/jsp/web-jsptaglibrary_3_0.xsd - -See licenses/LICENSE-EPL2.txt for the full license terms. - --------------------------------------------------------------------------- - -The following files are licensed under the CDDL 1.0: - - grails-gsp/grails-web-jsp/src/main/resources/org/grails/gsp/jsp/web-app_4_0.xsd - grails-gsp/grails-web-jsp/src/main/resources/org/grails/gsp/jsp/web-app_5_0.xsd - grails-gsp/grails-web-jsp/src/main/resources/org/grails/gsp/jsp/web-app_6_0.xsd - -See licenses/LICENSE-CDDL.txt for the full license terms. - --------------------------------------------------------------------------- - -This product includes software developed by the OpenSymphony Group (http://www.opensymphony.com/). It uses Sitemesh2, -licensed under the OpenSymphony Software License, Version 1.1. - -See licenses/LICENSE-opensymphony.txt for the full license terms. - --------------------------------------------------------------------------- - -The following files are licensed under the MIT: - - grails-spring-security/ui/plugin/grails-app/assets/javascripts/jquery/jquery.jdMenu.js - grails-spring-security/ui/plugin/grails-app/assets/javascripts/jquery/jquery.positionBy.js - grails-spring-security/ui/plugin/grails-app/assets/stylesheets/jquery.jdMenu.slate.css - grails-spring-security/ui/plugin/grails-app/assets/stylesheets/jquery.jdMenu.css - -See licenses/LICENSE-MIT.txt for the full license terms. - --------------------------------------------------------------------------- diff --git a/NOTICE b/NOTICE index 8a831c1a8a..6991fd5006 100644 --- a/NOTICE +++ b/NOTICE @@ -1,51 +1,5 @@ Apache Grails -Copyright 2005-2025 The Apache Software Foundation +Copyright 2005-2026 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). - - -Additional Licenses ------------------- - -This product uses the Jakarta Annotations™ API which is a trademark of the Eclipse Foundation. It is licensed under -the Eclipse Public License v. 2.0 which is available at https://www.eclipse.org/legal/epl-2.0. - -Project Reactor -This product includes software from Project Reactor, licensed under Apache License, Version 2.0. -2011-2014 Pivotal Software, Inc. - -The original XML Schemas for Java EE Deployment Descriptors: - - web-app_4_0.xsd - -may be obtained from: -http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/index.html - -This product includes software developed by the OpenSymphony Group (http://www.opensymphony.com/). It uses Sitemesh2, -licensed under the OpenSymphony Software License, Version 1.1. See licenses/LICENSE-opensymphony.txt for the full license terms. - -Liquibase Hibernate Integration -This product includes software developed by Liquibase.org (http://www.liquibase.org) and its contributors. -Licensed under Apache License, Version 2.0. - -Spring Framework ORM Hibernate 5 Support -This product includes software from the Spring Framework project (https://spring.io/projects/spring-framework), -vendored from Spring Framework 6.2.x. These classes were removed in Spring Framework 7.0. -Copyright 2002-2024 the original author or authors. -Licensed under the Apache License, Version 2.0. - -Spring Boot Undertow Support -This product includes software from the Spring Boot project (https://spring.io/projects/spring-boot), -vendored under grails-undertow/spring-boot from the spring-boot-undertow module of Spring Boot 4.0.0-M1. -The module was removed from Spring Boot before the 4.0.0 GA release. It also includes the Undertow -reactive server adapter classes from the Spring Framework project -(https://spring.io/projects/spring-framework), vendored from Spring Framework 6.2.19 -(org.springframework.http.server.reactive). These classes were removed in Spring Framework 7.0. -Copyright 2012-present the original author or authors. -Licensed under the Apache License, Version 2.0. - -Roboto Font -This product bundles the Roboto font (https://fonts.google.com/specimen/Roboto), used by the -GORM documentation website under grails-data-docs/data-mapping-website/. -Font data copyright Google 2012. -Licensed under the Apache License, Version 2.0. diff --git a/RELEASE.md b/RELEASE.md index c2be69f89b..704a6b1485 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -59,20 +59,26 @@ MAJOR.MINOR.PATCH[-MODIFIER] - **MODIFIER** is `-M<n>` (milestone), `-RC<n>` (release candidate), `-SNAPSHOT`, or omitted for a final release. Tags are `v` plus the version (`v8.0.0-M1`). The workflow strips the prefix -(`RELEASE_VERSION=${GITHUB_REF_NAME#v}`) and passes `-PprojectVersion=${RELEASE_VERSION}`. -The checked-in default in `gradle.properties` stays a snapshot (`8.0.0-SNAPSHOT`) between releases. +and runs `apache/grails-github-actions/pre-release@asf`. That action commits +`projectVersion=<version>` in `gradle.properties` and moves the tag to that commit. +The staged artifacts and source zip come from this updated tag, not the original commit. +After promotion, `post-release@asf` opens a merge-back PR with the next SNAPSHOT version. +Neither action changes `grailsVersion`; no extra `RELEASE_SCRIPT_PATH` is needed here. Milestones and RCs go through the same process as a final release. ## 1. Prerequisites -- The tag points at the exact commit to release. No SNAPSHOT dependencies; Apache +- The initial tag points at the code to release; pre-release adds the version commit. No SNAPSHOT dependencies; Apache [release policy](https://www.apache.org/legal/release-policy.html) forbids them. -- `projectVersion` is this repository's version. The release workflow overrides it with - `-PprojectVersion`. `grailsVersion` is the released Grails line (8.0.0) imported by the +- `projectVersion` is this repository's version. Pre-release writes the release version + into the tagged commit. `grailsVersion` is the released Grails line (8.0.0) imported by the BOMs and used by the Grails Gradle plugins. Do not point `grailsVersion` at a snapshot. - JDK is pinned in [`.sdkmanrc`](.sdkmanrc) (`25.0.3-librca`). CI and [`etc/bin/Dockerfile`](etc/bin/Dockerfile) must use the same Liberica patch. +- Every file referenced by `LICENSE` and `NOTICE` must be present in the source + package and, where applicable, the JARs. The verification suite rejects missing + referenced license texts even when RAT passes. - Secrets and variables: | Name | Purpose | @@ -83,21 +89,28 @@ Milestones and RCs go through the same process as a final release. | `NEXUS_STAGE_DEPLOYER_PW` | Staging password. | | `STAGING_PROFILE_ID` | Nexus staging profile. | | `STAGING_URL` | Repository variable for the staging API URL. | - | `DEVELOCITY_ACCESS_KEY` | Gradle Develocity (optional for a local rebuild). | + | `GRAILS_DEVELOCITY_ACCESS_KEY` | Gradle Develocity (optional for a local rebuild). | + | `SVC_DIST_GRAILS_USERNAME` | Service account for staging the source zip in SVN `dev`. | + | `SVC_DIST_GRAILS_PASSWORD` | SVN staging service account password. | Multi-line secrets such as the GPG key need a trailing newline. - The `release` / `close` / `docs` environments in [`.asf.yaml`](.asf.yaml) list reviewers - (GitHub caps private-group approvers; at most 6 named users). The current - [`release.yml`](.github/workflows/release.yml) stages JARs without those environment - gates. Promotion of the closed Nexus staging repository remains a **manual** PMC step. + (GitHub caps private-group approvers; at most 6 named users). Staging runs without + approval. The post-vote jobs use `release` for manual promotion instructions, + `docs` for the publication and announcement checkpoint, and `close` for the merge-back PR. + There is no documentation build or site deployment in this repository. +- GitHub must allow the workflow token to update the release tag, create a merge-back + branch and open pull requests. Promotion of Nexus and SVN remains a **manual** PMC step + using personal ASF credentials; the SVN service account can write only to `dev`. ## 2. Cut the release 1. Open <https://github.com/apache/grails-micronaut/releases> and **Draft a new release**. 2. Tag `v<version>` (for example `v8.0.0-M1`) targeting `8.0.x` (or the maintenance branch). 3. Generate release notes, then edit them. -4. Check **Set as a pre-release** for milestones and RCs. +4. Check **Set as a pre-release** while the candidate is under vote, including a final version. + Do not mark it latest until promotion succeeds. 5. **Publish release**. That starts the `Release` workflow. ## 3. What the `publish` job does @@ -108,12 +121,16 @@ The job in [`.github/workflows/release.yml`](.github/workflows/release.yml): 2. Sets `SOURCE_DATE_EPOCH` from the last commit time and `touch`es the tree to that epoch so archive and documentation timestamps match a local rebuild. 3. Uses Liberica JDK `25.0.3`. -4. Runs `./gradlew build rat -PprojectVersion=${RELEASE_VERSION} --no-build-cache`. -5. Initializes a Sonatype staging repository. -6. Imports `GRAILS_GPG_KEY` and publishes the four artifacts with - `publishToSonatype closeSonatypeStagingRepository aggregateChecksums aggregatePublishedArtifacts`. +4. Runs pre-release to commit `projectVersion` and update the tag, imports `GRAILS_GPG_KEY`, + then runs `./gradlew build rat --no-build-cache` so the staged bits are tested. +5. Initializes one Sonatype staging repository with description `grails-micronaut:<version>`. +6. Runs `findSonatypeStagingRepository publishToSonatype aggregateChecksums aggregatePublishedArtifacts` + with `-x initializeSonatypeStagingRepository`, then finds and closes that same repository + in a separate invocation, also excluding initialization. This avoids an orphan empty repository. 7. Writes `build/BUILD_DATE.txt`, `build/CHECKSUMS.txt`, and `build/PUBLISHED_ARTIFACTS.txt` - and attaches them to the GitHub Release. + and attaches them temporarily to the GitHub Release. The build date is the epoch recorded + before pre-release, matching grails-core. Use `BUILD_DATE`, not the moved tag's timestamp, + when rebuilding the voted artifacts. The staging repository is **closed**, not released. Do not promote it until verification and the vote succeed. @@ -124,29 +141,60 @@ ASF [release policy](https://www.apache.org/legal/release-policy.html) requires release to include a **signed source package**. Maven JARs are convenience binaries. The official vote artifact is the source zip, staged under `https://dist.apache.org/repos/dist/dev/grails/micronaut/<version>/sources/` -before the vote starts. This repository does not yet automate that zip; do it -from the tagged commit: - -1. Check out the release tag. Remove files that must not ship in an ASF source - release (`.git`, `.github`, `.asf.yaml`, and `gradle-wrapper.jar` if your - bootstrap regenerates it). -2. Copy `build/CHECKSUMS.txt`, `build/PUBLISHED_ARTIFACTS.txt`, and - `build/BUILD_DATE.txt` from the GitHub Release into the tree as `CHECKSUMS`, - `PUBLISHED_ARTIFACTS`, and `BUILD_DATE`. -3. Zip to `apache-grails-micronaut-<version>-src.zip`. -4. Detached-sign with the Grails key (`*.asc`) and write `*.sha512`. -5. Commit those three files to - `dist/dev/grails/micronaut/<version>/sources/` using your ASF SVN credentials - (infra grants the GitHub secret write to `dev` only). -6. Attach the same zip, `.asc`, and `.sha512` to the GitHub Release. - -After the vote passes, a PMC member moves that folder from `dist/dev` to -`dist/release` under their own credentials. Automating the zip job can follow -[apache/grails-gradle-publish](https://github.com/apache/grails-gradle-publish) -`.github/workflows/release.yaml`. +before the vote starts. The `source` and `upload` jobs now do this automatically: + +1. Check out the exact post-pre-release commit recorded by `publish`. +2. Remove `.git`, `.github`, agent worktrees, `KEYS`, and the root and `build-logic` + Gradle wrapper JARs, properties and launch scripts, including `gradlew.bat`. +3. Include `CHECKSUMS`, `PUBLISHED_ARTIFACTS` and `BUILD_DATE` from the publish job. + The manifests include the four coordinates' JARs, POMs and Gradle module metadata. +4. Normalize source timestamps and create `apache-grails-micronaut-<version>-src.zip` + with one top-level `grails-micronaut/` directory. Sign it and generate its SHA-512 file. +5. Attach the zip, `.asc` and `.sha512` to the GitHub Release and remove the temporary + manifest assets, which are now inside the signed zip. +6. Upload the same three files to SVN `dev/grails/micronaut/<version>/sources/`, + attach `DIST_SVN_REVISION.txt` to the GitHub Release, and print the PMC vote email. + +The upload refuses to overwrite an existing candidate directory. Abort the candidate +before staging a replacement. After the vote passes, a PMC member promotes the directory +with personal credentials. Nothing is promoted by the staging service account. ## 4. Verify staged artifacts +Use the automated suite from a checkout of the release tag with GNU coreutils, GPG, +curl, unzip, and the exact Liberica JDK and Gradle versions in `.sdkmanrc`: + +```shell +export PATH="$PWD:$PWD/etc/bin:$PATH" +verify.sh v8.0.0 /tmp/grails-micronaut-verify +``` + +The download location is scratch space, not the repository. The suite compares the GitHub +and SVN files, imports the official Grails KEYS into a temporary GPG home, verifies the +source signature and contents, and checks signatures and checksums for all four coordinates. +It rejects SNAPSHOT references in POMs and module metadata and checks JAR licenses and SBOMs. +It then runs RAT, builds and tests the extracted source with `--no-build-cache`, and compares +every published checksum, including BOM metadata. Any failure exits nonzero. + +The zip deliberately has no wrappers. Unlike core's multi-build `gradle-bootstrap` setup, +this build can use an external `gradlew` on `PATH` (the container and verification workflow +provide one) or the matching installed Gradle directly with `-p <extracted-source>`. +No wrapper files are copied into the source tree, and `build-logic` is an included build +that does not need its own wrapper. For a manual build with installed Gradle: + +```shell +cd /tmp/grails-micronaut-verify/grails-micronaut +export SOURCE_DATE_EPOCH="$(cat BUILD_DATE)" +export TEST_BUILD_REPRODUCIBLE=true +gradle build rat --no-build-cache +``` + +The individual `verify-*.sh` scripts can also be run separately. Use +`reset-verify.sh v8.0.0 /tmp/grails-micronaut-verify` before retrying in the same scratch +directory; it prompts before deleting the extracted tree and its verification results. +Alternatively dispatch [Release - Verify Troubleshooting](.github/workflows/release-verify.yml) +with the candidate tag. This workflow does not replace independent PMC verification. + ### 4.1 License audit ```shell @@ -171,14 +219,14 @@ throwaway checkout. ### 4.3 Rebuild vs staged JARs -Use `build/CHECKSUMS.txt` and `build/PUBLISHED_ARTIFACTS.txt` from the GitHub Release: +Use `CHECKSUMS` and `PUBLISHED_ARTIFACTS` inside the signed source zip: -1. Import [KEYS](KEYS) or <https://dist.apache.org/repos/dist/release/grails/KEYS>. +1. Import <https://dist.apache.org/repos/dist/release/grails/KEYS>. 2. Download each JAR (and `.asc`) from the Nexus staging repository listed in - `PUBLISHED_ARTIFACTS.txt`. + `PUBLISHED_ARTIFACTS` (use `GRAILS_REPO_URL` to select a specific staging repository). 3. `gpg --verify` each signature. -4. Compare SHA-512 to `CHECKSUMS.txt`. -5. Rebuild locally with the same `SOURCE_DATE_EPOCH` as `BUILD_DATE.txt` and +4. Compare SHA-512 to `CHECKSUMS`. +5. Rebuild locally with the same `SOURCE_DATE_EPOCH` as `BUILD_DATE` and `TEST_BUILD_REPRODUCIBLE=true` (disables signing) and compare hashes. Prefer the container in [Appendix: Verification from a container](#appendix-verification-from-a-container) @@ -197,32 +245,62 @@ Only Grails PMC votes are binding. Minimum 72 hours and three PMC +1 votes. Include the tag, commit SHA, staging repository URL, GitHub Release URL, and checksum file URLs so voters can inspect the same bits. +The `upload` job prints the adapted core template from `.github/vote_templates/staged.txt`. +Replace `<Thread Link>`, review the text, and send it yourself. No workflow sends email. ## 6. Promote After the vote passes: -1. Release the closed Nexus staging repository on - <https://repository.apache.org/#stagingRepositories> (or the project's release-jars - script, if you use one). Maven Central lag can be hours. -2. Record the release at <https://reporter.apache.org/addrelease.html?grails> as - `micronaut-<version>` on the day the staging repository was released. -3. Flag the GitHub Release as **latest** when it is a final line release. -4. Announce from your `@apache.org` address to `[email protected]`, - `[email protected]`, and `[email protected]`. -5. Move the signed source distribution from - `dist/dev/grails/micronaut/<version>/` to - `dist/release/grails/micronaut/<version>/` (manual SVN, PMC credentials). +1. Approve the `release` environment only after the minimum 72-hour vote passes. + The job prints the result email and manual promotion commands. Review and send the result. +2. Release the closed Nexus staging repository on + <https://repository.apache.org/#stagingRepositories>, or run: + + ```shell + .github/scripts/releaseJarFiles.sh grails-micronaut:8.0.0 <ASF_USER> + .github/scripts/releaseDistributions.sh v8.0.0 micronaut <ASF_USER> + ``` + + Both scripts prompt for personal ASF credentials and confirmation of the vote. + The second moves only `dev/grails/micronaut/<version>` to + `release/grails/micronaut/<version>` using SVN. It does not delete earlier releases. +3. Record `MICRONAUT-<version>` at <https://reporter.apache.org/addrelease.html?grails> + with the promotion date. Wait for Maven Central and download mirrors to catch up. +4. Approve the `docs` environment for the announcement checkpoint after promotion. + This repo has no separate documentation distribution or deployment job. Review the printed + announcement, replace the template placeholders, and send from your `@apache.org` address + to `[email protected]`, `[email protected]`, and `[email protected]`. +5. Approve `close`. The ASF post-release action closes the matching milestone, creates + `merge-back-<version>` from the released tag, bumps only `projectVersion` to the next + SNAPSHOT, and opens a PR into the release's maintenance branch. Merge with a merge commit, + not squash or rebase, so the tag becomes part of branch history. Clear the GitHub pre-release + flag for a final release and mark latest only when appropriate for the release line. + +If closing fails, run [Release - Close](.github/workflows/release-close.yml) from the matching +maintenance branch with the released version. It is protected by `close` and does not promote +artifacts. Inspect the original log first. If the token cannot push workflow changes or open +a PR, create the merge-back branch from the tag, update `projectVersion` to the next SNAPSHOT, +and open the merge-back PR with your own credentials. Do not change `grailsVersion`. ## Rollback Abort only **before** the staging repository is released to Maven Central. After that, ship a new version. -1. Drop the staging repository on repository.apache.org. -2. Cancel the GitHub Actions `Release` run. -3. Delete the GitHub Release and `git push --delete origin v<version>`. -4. If a `[VOTE]` thread exists, reply `[CANCEL][VOTE]` with the reason. +Run [Release - Abort Release](.github/workflows/release-abort.yml) with the candidate tag. +It requires `release` approval and a GitHub release still marked pre-release, and it refuses +to run if the version already exists in the Nexus releases repository or SVN `release`. +The workflow cancels the candidate's release runs and waits for them to stop, drops the Nexus +repository by description `grails-micronaut:<version>`, removes only +`dist/dev/grails/micronaut/<version>`, and deletes the GitHub Release and tag. Any SVN error +other than a missing path stops it before the release and tag are deleted. If a `[VOTE]` +thread exists, reply `[CANCEL][VOTE]` with the reason. + +To drop only a failed or orphan staging repository, use +[Release - Drop Nexus Staging](.github/workflows/release-drop-staging.yml) with its Nexus ID. +It also requires `release` approval and checks the configured staging profile before dropping. +It does not delete the GitHub Release, tag or SVN files. ## Appendix: GPG and KEYS @@ -250,9 +328,9 @@ Official artifacts are built on Ubuntu 24.04 with Liberica 25.0.3. The image in ```shell docker build -t grails-micronaut:testing -f etc/bin/Dockerfile . docker run -it --rm -v "$(pwd):/home/groovy/project" grails-micronaut:testing bash -# inside: -cd /home/groovy/project -etc/bin/test-reproducible-builds.sh +# inside the container: +cd /home/groovy/grails-verify +verify.sh v8.0.0 . ``` Anyone bumping the JDK in `.sdkmanrc` or `release.yml` must bump the Dockerfile `FROM` @@ -280,3 +358,4 @@ keeps the useful Grails reproducibility work and drops the grails-core dual-JDK Common gotchas: properties files that embed `Date.toString()`, unsorted reflection, a different JDK patch, and Gradle's remote cache. Do not ship generated `.properties` with a timestamp comment. Sort anything taken from `Class.getDeclaredMethods()`. + diff --git a/etc/bin/download-release-artifacts.sh b/etc/bin/download-release-artifacts.sh new file mode 100755 index 0000000000..67ffead3d3 --- /dev/null +++ b/etc/bin/download-release-artifacts.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail +tag=${1:?Usage: download-release-artifacts.sh <tag> [download location]} +[[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-(M|RC)[0-9]+)?$ ]] +version=${tag#v} +location=$(realpath -m "${2:-downloads}") +mkdir -p "$location" +file="apache-grails-micronaut-$version-src.zip" +for suffix in '' .asc .sha512; do + curl -fsSL -o "$location/github-$file$suffix" "https://github.com/apache/grails-micronaut/releases/download/$tag/$file$suffix" + curl -fsSL -o "$location/$file$suffix" "https://dist.apache.org/repos/dist/dev/grails/micronaut/$version/sources/$file$suffix" + cmp "$location/$file$suffix" "$location/github-$file$suffix" +done +echo 'PASS: GitHub and SVN source release files match' diff --git a/etc/bin/reset-verify.sh b/etc/bin/reset-verify.sh new file mode 100755 index 0000000000..89739b9e03 --- /dev/null +++ b/etc/bin/reset-verify.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail +tag=${1:?Usage: reset-verify.sh <tag> [download location]} +[[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-(M|RC)[0-9]+)?$ ]] +location=$(realpath "${2:-downloads}") +source_dir="$location/grails-micronaut" +if [[ -d "$source_dir" ]]; then + test ! -e "$source_dir/.git" + test -s "$source_dir/CHECKSUMS" + test -s "$source_dir/PUBLISHED_ARTIFACTS" + test "$(sed -n 's/^projectVersion=//p' "$source_dir/gradle.properties")" = "${tag#v}" + read -r -p "Remove extracted source at $source_dir (including verification results)? [y/N] " confirm + [[ "$confirm" =~ ^[Yy](es)?$ ]] + rm -rf -- "$source_dir" +fi +file="apache-grails-micronaut-${tag#v}-src.zip" +for suffix in '' .asc .sha512; do + rm -f -- "$location/$file$suffix" "$location/github-$file$suffix" +done +echo 'Verification scratch files removed.' diff --git a/etc/bin/verify-jar-artifacts.sh b/etc/bin/verify-jar-artifacts.sh new file mode 100755 index 0000000000..c5edeb4668 --- /dev/null +++ b/etc/bin/verify-jar-artifacts.sh @@ -0,0 +1,86 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail +tag=${1:?Usage: verify-jar-artifacts.sh <tag> [download location]} +[[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-(M|RC)[0-9]+)?$ ]] +version=${tag#v} +location=$(realpath "${2:-downloads}") +source_dir="$location/grails-micronaut" +artifacts="$source_dir/PUBLISHED_ARTIFACTS" +checksums="$source_dir/CHECKSUMS" +test -s "$artifacts" +test -s "$checksums" +gpg_home=$(mktemp -d) +trap 'rm -rf "$gpg_home"' EXIT +gpg --homedir "$gpg_home" --batch --import "$location/KEYS" +work="$source_dir/etc/bin/results/first" +mkdir -p "$work" +cd "$work" +repo=${GRAILS_REPO_URL:-https://repository.apache.org/content/groups/staging} +declare -A seen=() +while read -r file coordinates extra; do + test -z "$extra" + IFS=: read -r group artifact artifact_version classifier <<< "$coordinates" + test "$group" = org.apache.grails + test "$artifact_version" = "$version" + case "$artifact" in + grails-micronaut|grails-micronaut-bom|grails-hibernate5-micronaut-bom|grails-hibernate7-micronaut-bom) ;; + *) echo "Unexpected coordinate: $coordinates" >&2; exit 1 ;; + esac + case "$file" in + "$artifact-$version.jar"|"$artifact-$version-sources.jar"|"$artifact-$version-javadoc.jar"|"$artifact-$version.pom"|"$artifact-$version.module") ;; + *) echo "Unexpected artifact file: $file" >&2; exit 1 ;; + esac + if [[ "$file" == *.jar ]]; then + test "$file" = "$artifact-$version${classifier:+-$classifier}.jar" + else + test -z "$classifier" + fi + test -z "${seen[$file]:-}" + seen[$file]=1 + url="$repo/org/apache/grails/$artifact/$version/$file" + curl -fsSL -o "$file" "$url" + curl -fsSL -o "$file.asc" "$url.asc" + gpg --homedir "$gpg_home" --batch --verify "$file.asc" "$file" + expected=$(awk -v f="$file" '$1 == f {print $2}' "$checksums") + [[ "$expected" =~ ^[0-9a-fA-F]{128}$ ]] + printf '%s %s\n' "$expected" "$file" | sha512sum -c - + if [[ "$file" == *.pom || "$file" == *.module ]]; then + if grep -q SNAPSHOT "$file"; then + echo "SNAPSHOT dependency in $file" >&2 + exit 1 + fi + elif [[ "$file" != *-javadoc.jar ]]; then + jar_entries=$(jar tf "$file") + for required in META-INF/LICENSE META-INF/NOTICE; do + grep -Fx "$required" <<< "$jar_entries" >/dev/null + while read -r referenced; do + grep -Fx "META-INF/$referenced" <<< "$jar_entries" >/dev/null + done < <(unzip -p "$file" "$required" | sed -n 's/.*See \([^ ]*\) for the full license terms.*/\1/p') + done + sbom=$(unzip -p "$file" META-INF/MANIFEST.MF | tr -d '\r' | sed -n 's/^Sbom-Location: *//p') + if [[ -n "$sbom" ]]; then + grep -Fx "$sbom" <<< "$jar_entries" >/dev/null + fi + fi +done < "$artifacts" +for artifact in grails-micronaut grails-micronaut-bom grails-hibernate5-micronaut-bom grails-hibernate7-micronaut-bom; do + test "${seen[$artifact-$version.pom]:-}" = 1 +done +test "${seen[grails-micronaut-$version.jar]:-}" = 1 +diff -u <(awk '{print $1}' "$artifacts" | sort) <(awk '{print $1}' "$checksums" | sort) +echo 'PASS: All four coordinates, signatures, checksums and JAR licenses verified' diff --git a/etc/bin/verify-keys.sh b/etc/bin/verify-keys.sh new file mode 100755 index 0000000000..a50690910b --- /dev/null +++ b/etc/bin/verify-keys.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail +location=$(realpath -m "${1:-downloads}") +scripts=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) +mkdir -p "$location" +curl -fsSL -o "$location/KEYS" https://dist.apache.org/repos/dist/release/grails/KEYS +if [[ -f "$scripts/../../KEYS" ]]; then + cmp "$location/KEYS" "$scripts/../../KEYS" + echo 'PASS: SVN and checked-in KEYS match' +else + echo 'Using official Grails KEYS. Source distributions intentionally omit KEYS.' +fi +test -s "$location/KEYS" diff --git a/etc/bin/verify-reproducible.sh b/etc/bin/verify-reproducible.sh new file mode 100755 index 0000000000..d2465079ff --- /dev/null +++ b/etc/bin/verify-reproducible.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail +location=$(realpath "${1:-downloads}") +source_dir="$location/grails-micronaut" +scripts=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) +results="$source_dir/etc/bin/results" +test -s "$source_dir/CHECKSUMS" +test -d "$results/first" +SOURCE_DATE_EPOCH=$(cat "$source_dir/BUILD_DATE") +export SOURCE_DATE_EPOCH +export TEST_BUILD_REPRODUCIBLE=true +export GRAILS_PUBLISH_RELEASE=true +if [[ -z "${GRADLE_CMD:-}" ]]; then + if command -v gradlew >/dev/null; then + GRADLE_CMD=$(command -v gradlew) + else + GRADLE_CMD=$(command -v gradle) + fi +fi +cd "$source_dir" +find . -depth \( -type f -o -type d \) -exec touch -d "@${SOURCE_DATE_EPOCH}" {} + +find . -depth -type l -exec touch -h -d "@${SOURCE_DATE_EPOCH}" {} + +"$GRADLE_CMD" -p "$source_dir" build :aggregateChecksums :aggregatePublishedArtifacts --rerun-tasks --no-build-cache --no-daemon +mkdir -p "$results/second" +"$scripts/generate-build-artifact-hashes.sh" "$source_dir" > "$results/rebuilt-jars.txt" +find . -path ./etc -prune -o -type f \( -path '*/build/libs/*.jar' -o -path '*/build/publication-metadata/*' \) -exec cp -t "$results/second" -- {} + +sort "$source_dir/CHECKSUMS" > "$results/first.txt" +sort build/CHECKSUMS.txt > "$results/second.txt" +if ! diff -u "$results/first.txt" "$results/second.txt" > "$results/diff.txt"; then + cat "$results/diff.txt" + echo "FAIL: Rebuilt artifacts differ. Inspect $results/first and $results/second with extract-build-artifact.sh." >&2 + exit 1 +fi +diff -u <(sort "$source_dir/PUBLISHED_ARTIFACTS") <(sort build/PUBLISHED_ARTIFACTS.txt) +echo 'PASS: Rebuilt JARs, BOM POMs and module metadata match the staged artifacts' diff --git a/etc/bin/verify-source-distribution.sh b/etc/bin/verify-source-distribution.sh new file mode 100755 index 0000000000..a143a50bca --- /dev/null +++ b/etc/bin/verify-source-distribution.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail +tag=${1:?Usage: verify-source-distribution.sh <tag> [download location]} +[[ "$tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-(M|RC)[0-9]+)?$ ]] +version=${tag#v} +location=$(realpath "${2:-downloads}") +cd "$location" +file="apache-grails-micronaut-$version-src.zip" +sha512sum -c "$file.sha512" +gpg_home=$(mktemp -d) +trap 'rm -rf "$gpg_home"' EXIT +gpg --homedir "$gpg_home" --batch --import "$location/KEYS" +gpg --homedir "$gpg_home" --batch --verify "$file.asc" "$file" +entries=$(unzip -Z1 "$file") +while IFS= read -r entry; do + [[ "$entry" == grails-micronaut/* && "$entry" != *'/../'* && "$entry" != *'\'* ]] + if [[ "$entry" =~ /\.(git|github|omo|worktrees)(/|$) || "$entry" == *'/.claude/worktrees/'* || + "$entry" =~ ^grails-micronaut/(build-logic/)?(gradlew(\.bat)?|gradle/wrapper/gradle-wrapper\.(jar|properties))$ || + "$entry" == grails-micronaut/KEYS ]]; then + echo "Forbidden source entry: $entry" >&2 + exit 1 + fi +done <<< "$entries" +if [[ -e grails-micronaut ]]; then + echo 'Extracted source already exists. Use reset-verify.sh or a fresh download location.' >&2 + exit 1 +fi +unzip -q "$file" +for required in LICENSE NOTICE README.md RELEASE.md PUBLISHED_ARTIFACTS CHECKSUMS BUILD_DATE .sdkmanrc; do + test -s "grails-micronaut/$required" +done +test "$(sed -n 's/^projectVersion=//p' grails-micronaut/gradle.properties)" = "$version" +grep -Eq '^[0-9]+$' grails-micronaut/BUILD_DATE +for meta in LICENSE NOTICE; do + while read -r referenced; do + if [[ ! -f "grails-micronaut/$referenced" ]]; then + echo "FAIL: $meta references missing license file $referenced" >&2 + exit 1 + fi + done < <(sed -n 's/.*See \([^ ]*\) for the full license terms.*/\1/p' "grails-micronaut/$meta") +done +echo 'PASS: Source signature, checksum and contents verified' diff --git a/etc/bin/verify.sh b/etc/bin/verify.sh new file mode 100755 index 0000000000..8c268dbcc3 --- /dev/null +++ b/etc/bin/verify.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -euo pipefail +if [[ $# -lt 1 || ! "$1" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-(M|RC)[0-9]+)?$ ]]; then + echo "Usage: $0 <release-tag> [download location]" >&2 + exit 1 +fi +tag=$1 +location=$(realpath -m "${2:-downloads}") +scripts=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd) +trap 'echo "FAIL: Release verification failed." >&2' ERR +for tool in java jar gpg curl unzip sha512sum realpath awk diff sort cmp; do + command -v "$tool" >/dev/null +done +if command -v gradlew >/dev/null; then + GRADLE_CMD=$(command -v gradlew) +else + GRADLE_CMD=$(command -v gradle) +fi +export GRADLE_CMD +mkdir -p "$location" +"$scripts/verify-keys.sh" "$location" +"$scripts/download-release-artifacts.sh" "$tag" "$location" +"$scripts/verify-source-distribution.sh" "$tag" "$location" +source_dir="$location/grails-micronaut" +expected_gradle=$(sed -n 's/^gradle=//p' "$source_dir/.sdkmanrc") +actual_gradle=$("$GRADLE_CMD" --version | awk '/^Gradle / {print $2}') +test "$actual_gradle" = "$expected_gradle" +expected_java=$(sed -n 's/^java=\([^-]*\)-librca$/\1/p' "$source_dir/.sdkmanrc") +java_settings=$(java -XshowSettings:properties -version 2>&1) +actual_java=$(awk '/java.version =/ {print $3}' <<< "$java_settings") +test -n "$expected_java" +test "$actual_java" = "$expected_java" +grep -qi BellSoft <<< "$java_settings" +"$scripts/verify-jar-artifacts.sh" "$tag" "$location" +SOURCE_DATE_EPOCH=$(cat "$source_dir/BUILD_DATE") +export SOURCE_DATE_EPOCH +"$GRADLE_CMD" -p "$source_dir" :rat --no-build-cache +echo 'PASS: RAT passed' +"$scripts/verify-reproducible.sh" "$location" +echo 'PASS: Automatic release verification finished. Review the source, licenses and integration tests before voting.' diff --git a/gradle/rat-root-config.gradle b/gradle/rat-root-config.gradle index 72bbe77935..317a74bda7 100644 --- a/gradle/rat-root-config.gradle +++ b/gradle/rat-root-config.gradle @@ -21,6 +21,9 @@ tasks.named('rat') { excludes = [ '.asf.yaml', '.github/**', + 'BUILD_DATE', + 'CHECKSUMS', + 'PUBLISHED_ARTIFACTS', '.git-blame-ignore-revs', '.idea/**', '.omo/**',
