This is an automated email from the ASF dual-hosted git repository. seanglover pushed a commit to branch seglo/publish-to-nightlies in repository https://gitbox.apache.org/repos/asf/incubator-pekko.git
commit 085fb69ed710632690f30d224cf28ad68d91f557 Author: Sean Glover <[email protected]> AuthorDate: Sun Nov 27 15:32:59 2022 -0500 wip --- .github/actions/sync-nightlies/action.yml | 91 ++++++++++++++++++++++++ .github/workflows/publish-nightly.yml | 112 ++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 6 -- 3 files changed, 203 insertions(+), 6 deletions(-) diff --git a/.github/actions/sync-nightlies/action.yml b/.github/actions/sync-nightlies/action.yml new file mode 100644 index 0000000000..19ae97ac59 --- /dev/null +++ b/.github/actions/sync-nightlies/action.yml @@ -0,0 +1,91 @@ +# 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 + remote_host_key: + description: 'The host key for StrictHostKeyChecking' + + 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 }}" + HOST_KEY: "${{ inputs.remote_host_key }}" + 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 UserKnownHostsFile=.ssh/known_hosts -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..096d7f416c --- /dev/null +++ b/.github/workflows/publish-nightly.yml @@ -0,0 +1,112 @@ +# 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: Upload Java Nightly builds + +on: + workflow_dispatch: + inputs: + keep: + description: Number of versions to keep. + required: false + default: 60 + schedule: + - cron: "0 0 * * *" + +permissions: + contents: read + +jobs: + upload: + runs-on: ubuntu-20.04 + if: github.repository == 'apache/incubator-pekko' + env: + - GROUP_ID: 'com.typesafe.akka' + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set up JDK 11 + uses: olafurpg/setup-scala@v13 + with: + java-version: [email protected] + + - name: Publish local + run: |- + sudo apt-get install graphviz + # disable mima check until first pekko release is done + # sbt +mimaReportBinaryIssues + sbt +publishLocal + + - name: Cache Coursier cache + uses: coursier/[email protected] + + - name: Sync from Remote + uses: ./incubator-pekko/.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 }} + remote_host_key: ${{ secrets.NIGHTLIES_RSYNC_HOST_KEY }} + + - shell: bash + name: Show local repo sync from remote + run: | + for i in `ls -t repo/$GROUP_ID/`; do + echo "- $i: $(find repo/$GROUP_ID/$i -mindepth 1 -maxdepth 1 -type d \ + | wc -l \ + | xargs) versions available" + done + + - shell: bash + name: Copy snapshot from local ivy repository + run: | + cp -R $HOME/.ivy2/local/$GROUP_ID/ repo + - name: Prune Repository + shell: bash + env: + KEEP: ${{ github.event.inputs.keep }} + run: | + for i in `ls -t repo/$GROUP_ID`; do + find repo/$GROUP_ID/$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: ./incubator-pekko/.github/actions/sync-nightlies + with: + upload: true + 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 }} + remote_host_key: ${{ secrets.NIGHTLIES_RSYNC_HOST_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: --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
