pjfanning commented on code in PR #2314: URL: https://github.com/apache/pekko/pull/2314#discussion_r2417975036
########## .github/workflows/stage-release-candidate.yml: ########## @@ -0,0 +1,143 @@ +# 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 +# +# http://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: Stage release candidate + +on: + workflow_dispatch: + inputs: + source-tar: + description: "Stage the source tarball to svn" + default: true + type: boolean + jars: + description: "Stage the binary jars to nexus" + default: true + type: boolean + +permissions: + contents: read + +jobs: + # Automating the step at https://github.com/apache/pekko-site/wiki/Pekko-Release-Process#build-the-source-release-candidate + # Partly based on https://github.com/apache/daffodil/blob/main/.github/workflows/release-candidate.yml + stage-release-candidate-to-svn: + runs-on: ubuntu-24.04 + if: ${{ inputs.source-tar }} + steps: + - name: Check version parameter + run: |- + if [[ "$REF" != *"-RC"* ]]; then + echo "Trigger this workflow on an RC tag" + exit 1 + fi + export VERSION=$(echo $REF | sed -e "s/\(.*\)-.*/\\1/") + echo "Version: $VERSION" + echo "RC: $REF" + env: + REF: ${{ github.ref_name }} + + - name: Checkout + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + fetch-depth: 0 + fetch-tags: true + persist-credentials: false + + - name: Generate source archive + run: |- + VERSION=$(echo $REF | sed -e "s/\(.*\)-.*/\\1/") + PREFIX=apache-pekko-$VERSION + DATE=$(git log -n1 --format=%cs | tr -d -) + TARBALL=$PREFIX-src-$DATE.tgz + + mkdir archive + git archive --format=tar --prefix=$PREFIX/ HEAD | gzip -6 -n > archive/$TARBALL + cd archive + sha512sum $TARBALL > $TARBALL.sha512 + env: + REF: ${{ github.ref_name }} + + - name: Sign source archive + run: |- + echo $PEKKO_GPG_SECRET_KEY | base64 -d | gpg --batch --import --import-options import-show + gpg -ab archive/*.tgz + env: + PEKKO_GPG_SECRET_KEY: ${{ secrets.PEKKO_GPG_SECRET_KEY }} + + - name: Upload source dist + run: |- + svn checkout https://dist.apache.org/repos/dist/dev/pekko dist + cd dist + mkdir $REF + cp ../archive/* $REF + svn add $REF $REF/* + svn commit --username $PEKKO_SVN_DEV_USERNAME --password $PEKKO_SVN_DEV_PASSWORD --message "Stage Pekko $REF" $REF + env: + PEKKO_SVN_DEV_USERNAME: ${{ secrets.PEKKO_SVN_DEV_USERNAME }} + PEKKO_SVN_DEV_PASSWORD: ${{ secrets.PEKKO_SVN_DEV_PASSWORD }} + REF: ${{ github.ref_name }} + + stage-jars-to-nexus: + runs-on: ubuntu-24.04 + if: ${{ inputs.source-tar }} + steps: + - name: Check version parameter + run: |- + if [[ "$REF" != *"-RC"* ]]; then + echo "Trigger this workflow on an RC tag" + exit 1 + fi + export VERSION=$(echo $REF | sed -e "s/\(.*\)-.*/\\1/") + echo "Version: $VERSION" + echo "RC: $REF" + env: + REF: ${{ github.ref_name }} + + - name: Checkout + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + with: + fetch-depth: 0 + fetch-tags: true + persist-credentials: false + + - name: Setup Java 17 + uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 # v5.0.0 + with: + distribution: temurin + java-version: 17 + + - name: Install sbt + uses: sbt/setup-sbt@17575ea4e18dd928fe5968dbe32294b97923d65b # v1.1.13 + + # We intentionally do not use the Coursier cache for release candiates, + # to reduce attack surface + + # It would be better to split this into 3 steps, where only the first + # uses sbt and the signing/staging are done with well-known tools + # reducing attack surface, but this seems to be the state of the art: + - name: Build, sign and stage artifacts + run: |- + VERSION=$(echo $REF | sed -e "s/\(.*\)-.*/\\1/") + PGP_PASSPHRASE= + + sbt "set ThisBuild / version := \"$VERSION\"; +publishSigned" + env: Review Comment: with the sbt setup that we have, `sbt publishSigned` when a version tag is found on most recent commit, the jars are just staged in the target directory locally - you need to run an sbt-sonatype command to push to nexus. `sbt "sonatypePrepare; sonatypeBundleUpload; sonatypeClose"` https://github.com/apache/pekko-site/wiki/Pekko-Release-Process I have previously found that setting the version in the sbt command can be problematic with this command - the version seems not to propagate in all stages. It is worth playing with the commands locally. You could drop an RC tag locally and run `sbt "set ThisBuild / version := \"$VERSION\"; publishSigned` (maybe just one scala version to cut down on build time in a dry run) and then the `sbt "set ThisBuild / version := \"$VERSION\"; sonatypePrepare; sonatypeBundleUpload; sonatypeClose"`. A bit of trial and error, you might find something that works. It is easy to go into repository.apache.org and drop the staged repos. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
