From 281a08689716c88def069b815092b7fb97abadca Mon Sep 17 00:00:00 2001 From: Sean Glover Date: Sat, 14 Jan 2023 13:47:15 -0500 Subject: [PATCH] Publish to Apache nightlies server (#60) --- .github/actions/sync-nightlies/action.yml | 86 ++++++++++++++++ .github/workflows/publish-nightly.yml | 116 ++++++++++++++++++++++ .github/workflows/publish.yml | 6 -- RELEASING.md | 2 - docs/src/main/paradox/project/links.md | 10 +- docs/src/main/paradox/project/scala3.md | 12 +-- 6 files changed, 213 insertions(+), 19 deletions(-) create mode 100644 .github/actions/sync-nightlies/action.yml create mode 100644 .github/workflows/publish-nightly.yml diff --git a/.github/actions/sync-nightlies/action.yml b/.github/actions/sync-nightlies/action.yml new file mode 100644 index 0000000000..6a8deff54e --- /dev/null +++ b/.github/actions/sync-nightlies/action.yml @@ -0,0 +1,86 @@ +# 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. + +# Based on Apache Arrow's sync-nightlies action +# https://github.com/apache/arrow/blob/master/.github/actions/sync-nightlies/action.yml +name: 'Sync Nightlies' +description: 'Sync files to and from nightlies.apache.org' +inputs: + upload: + description: 'Sync from local to remote' + default: false + required: false + switches: + description: 'see rsync --help' + required: true + local_path: + description: 'The relative local path within $GITHUB_WORKSPACE' + required: true + remote_path: + description: 'The remote path incl. sub dirs e.g. {{secrets.path}}/arrow/r' + required: true + remote_host: + description: 'The remote host' + required: true + remote_port: + description: 'The remote port' + required: false + default: 22 + remote_user: + description: 'The remote user' + required: true + remote_key: + description: 'The remote key' + required: true + +runs: + using: "composite" + steps: + - name: Sync files + shell: bash + env: + SWITCHES: "${{ inputs.switches }}" + LOCAL_PATH: "${{ github.workspace }}/${{ inputs.local_path }}" + + SSH_KEY: "${{ inputs.remote_key }}" + PORT: "${{ inputs.remote_port }}" + USER: "${{ inputs.remote_user }}" + HOST: "${{ inputs.remote_host }}" + REMOTE_PATH: "${{ inputs.remote_path }}" + run: | + # Make SSH key available and add remote to known hosts + eval "$(ssh-agent)" > /dev/null + echo "$SSH_KEY" | tr -d '\r' | ssh-add - >/dev/null + mkdir -p .ssh + chmod go-rwx .ssh + echo "$HOST_KEY" >> .ssh/known_hosts + # strict errors + set -eu + # We have to use a custom RSH to supply the port + RSH="ssh -o StrictHostKeyChecking=no -p $PORT" + DSN="$USER@$HOST" + # It is important to append '/' to the source path otherwise + # the entire source dir will be created as a sub dir in the destination + if [ "${{ inputs.upload }}" = true ] + then + SOURCE=$LOCAL_PATH/ + DEST=$DSN:$REMOTE_PATH + else + SOURCE=$DSN:$REMOTE_PATH/ + DEST=$LOCAL_PATH + fi + rsync $SWITCHES --rsh="$RSH" $SOURCE $DEST diff --git a/.github/workflows/publish-nightly.yml b/.github/workflows/publish-nightly.yml new file mode 100644 index 0000000000..bf28fe8582 --- /dev/null +++ b/.github/workflows/publish-nightly.yml @@ -0,0 +1,116 @@ +# 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. + +# Based on Apache Arrow's java-nightly workflow +# https://github.com/apache/arrow/blob/master/.github/workflows/java_nightly.yml +name: Publish nightly artifacts + +on: + workflow_dispatch: + inputs: + keep: + description: Number of versions to keep. + required: false + default: 30 + schedule: + - cron: "0 0 * * *" + push: + branches: + - 'main' + +permissions: + contents: read + +jobs: + publish-nightly: + name: Publish nightly + runs-on: ubuntu-20.04 + if: github.repository == 'apache/incubator-pekko' + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up JDK 11 + uses: olafurpg/setup-scala@v13 + with: + java-version: adopt@1.11 + + - name: Publish local + run: |- + sudo apt-get install graphviz + # disable mima check until first pekko release is done + # sbt +mimaReportBinaryIssues + sbt +publishM2 + + - name: Cache Coursier cache + uses: coursier/cache-action@v6.4.0 + + - name: Sync from remote + uses: ./.github/actions/sync-nightlies + with: + switches: -avzh --update --delete --progress + local_path: repo + remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/pekko/snapshots + remote_host: ${{ secrets.NIGHTLIES_RSYNC_HOST }} + remote_port: ${{ secrets.NIGHTLIES_RSYNC_PORT }} + remote_user: ${{ secrets.NIGHTLIES_RSYNC_USER }} + remote_key: ${{ secrets.NIGHTLIES_RSYNC_KEY }} + + - shell: bash + name: Show local repo sync from remote + run: | + for i in `ls -t repo/org/apache/pekko/`; do + echo "- $i: $(find repo/org/apache/pekko/$i -mindepth 1 -maxdepth 1 -type d \ + | wc -l \ + | xargs) versions available" + done + + - shell: bash + name: Copy snapshots from local m2 repository + run: | + mkdir -p repo/org/apache/pekko/ + cp -R $HOME/.m2/repository/org/apache/pekko/ repo/org/apache + + - name: Prune repository + shell: bash + env: + KEEP: ${{ github.event.inputs.keep || 30 }} + run: | + for i in `ls -t repo/org/apache/pekko/`; do + find repo/org/apache/pekko/$i -mindepth 1 -maxdepth 1 -type d -print0 \ + | xargs -0 ls -t -d \ + | tail -n +$((KEEP + 1)) \ + | xargs rm -rf + done + + - name: Show repo contents + run: tree repo + + - name: Sync to Remote + if: ${{ github.repository == 'apache/incubator-pekko' }} + uses: ./.github/actions/sync-nightlies + with: + upload: true + switches: -avzh --omit-dir-times --update --delete --progress + local_path: repo + remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/pekko/snapshots + remote_host: ${{ secrets.NIGHTLIES_RSYNC_HOST }} + remote_port: ${{ secrets.NIGHTLIES_RSYNC_PORT }} + remote_user: ${{ secrets.NIGHTLIES_RSYNC_USER }} + remote_key: ${{ secrets.NIGHTLIES_RSYNC_KEY }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0b00ecf579..bfef5c8c94 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,12 +2,6 @@ name: Publish on: push: - branches: - - master - - main - # for testing the GH Action without merging to main, - # in some cases - - test-publish-snapshots tags: ["*"] jobs: diff --git a/RELEASING.md b/RELEASING.md index f54504b4ca..12d28b9fde 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -51,8 +51,6 @@ scaladoc generation build task, which is part of the release. ## Snapshot releases To create snapshot versions manually, use `sbt clean publishLocal`. -If you have access, you can use `+publishSigned` to publish them to -sonatype. ## Releasing only updated docs diff --git a/docs/src/main/paradox/project/links.md b/docs/src/main/paradox/project/links.md index d7e11fccdb..bf74b4048f 100644 --- a/docs/src/main/paradox/project/links.md +++ b/docs/src/main/paradox/project/links.md @@ -32,11 +32,11 @@ All Akka releases are published via Sonatype to Maven Central, see ## Snapshots Repository -Snapshot builds are available at [https://oss.sonatype.org/content/repositories/snapshots/com/typesafe/akka/](https://oss.sonatype.org/content/repositories/snapshots/com/typesafe/akka/). All Akka modules that belong to the same build have the same version. +Snapshot builds are published nightly and are available for 30 days at [https://nightlies.apache.org/pekko/snapshots/org/apache/pekko/](https://nightlies.apache.org/pekko/snapshots/org/apache/pekko/). All Apache Pekko modules that belong to the same build have the same version. @@@ warning -The use of Akka SNAPSHOTs, nightlies and milestone releases is discouraged unless you know what you are doing. +The use of Apache Pekko SNAPSHOTs, nightlies and milestone releases is discouraged unless you know what you are doing. @@@ @@ -45,7 +45,7 @@ The use of Akka SNAPSHOTs, nightlies and milestone releases is discouraged unles Make sure that you add the repository to the sbt resolvers: ``` -resolvers ++= Resolver.sonatypeOssRepos("snapshots") +resolvers ++= "Apache Pekko Snapshots" at "https://nightlies.apache.org/pekko/snapshots" ``` Define the library dependencies with the complete version. For example: @@ -63,8 +63,8 @@ Make sure that you add the repository to the Maven repositories in pom.xml: ``` - oss-sonatype - https://oss.sonatype.org/content/repositories/snapshots + apache-pekko-snapshots + https://nightlies.apache.org/pekko/snapshots default true diff --git a/docs/src/main/paradox/project/scala3.md b/docs/src/main/paradox/project/scala3.md index 784dfbb33a..1d0ee7903f 100644 --- a/docs/src/main/paradox/project/scala3.md +++ b/docs/src/main/paradox/project/scala3.md @@ -1,19 +1,19 @@ # Scala 3 support -Akka has experimental support for Scala 3. +Apache Pekko has experimental support for Scala 3. ## Using 2.13 artifacts in Scala 3 You can use [CrossVersion.for3Use2_13](https://scala-lang.org/blog/2021/04/08/scala-3-in-sbt.html#using-scala-213-libraries-in-scala-3) -to use the regular 2.13 Akka artifacts in a Scala 3 project. This has been +to use the regular 2.13 Apache Pekko artifacts in a Scala 3 project. This has been shown to be successful for Streams, HTTP and gRPC-heavy applications. ## Scala 3 artifacts -Starting with Akka version 2.6.18 (and on current [development snapshots](https://oss.sonatype.org/content/repositories/snapshots/com/typesafe/akka/akka-actor_3/)), -we are publishing experimental Scala 3 artifacts that can be used 'directly' -(without `CrossVersion`) with Scala 3. +Experimental Scala 3 artifacts are published. -We encourage you to try out these artifacts and [report any findings](https://github.com/akka/akka/issues?q=is%3Aopen+is%3Aissue+label%3At%3Ascala-3). +[Development snapshots](https://nightlies.apache.org/pekko/snapshots/org/apache/pekko/pekko-actor_3/) can be found in the snapshots repository. + +We encourage you to try out these artifacts and [report any findings](https://github.com/apache/incubator-pekko/issues?q=is%3Aopen+is%3Aissue+label%3At%3Ascala-3). We do not promise @ref:[binary compatibility](../common/binary-compatibility-rules.md) for these artifacts yet.