This is an automated email from the ASF dual-hosted git repository.

fanningpj pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-pekko-grpc.git


The following commit(s) were added to refs/heads/main by this push:
     new 10798d26 publish grpc docs to nightlies.apache.org (#62)
10798d26 is described below

commit 10798d26fe90440ba3cb520485552f7776002aad
Author: PJ Fanning <[email protected]>
AuthorDate: Mon May 1 20:04:14 2023 +0200

    publish grpc docs to nightlies.apache.org (#62)
---
 .github/actions/sync-nightlies/action.yml | 86 +++++++++++++++++++++++++++++++
 .github/workflows/publish.yml             | 53 ++++++++-----------
 2 files changed, 108 insertions(+), 31 deletions(-)

diff --git a/.github/actions/sync-nightlies/action.yml 
b/.github/actions/sync-nightlies/action.yml
new file mode 100644
index 00000000..6a8deff5
--- /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.yml b/.github/workflows/publish.yml
index 1d4ec872..266c5abe 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -53,34 +53,25 @@ jobs:
 #      - name: Publish Plugin to Gradle Plugin Repository
 #        run: cd gradle-plugin && ./gradlew publishPlugins 
-Pgradle.publish.key='${{ secrets.GRADLE_PUBLISH_KEY }}' 
-Pgradle.publish.secret='${{ secrets.GRADLE_SECRET }}'
 
-# TODO: Replace doc publishing with our own solution
-#  documentation:
-#    name: Documentation
-#    runs-on: ubuntu-latest
-#    if: github.repository == 'apache/incubator-pekko-grpc'
-#    steps:
-#      - name: Checkout
-#        uses: actions/checkout@v3
-#        with:
-#          # we don't know what commit the last tag was it's safer to get 
entire repo so previousStableVersion resolves
-#          fetch-depth: 0
-#
-#      - name: Setup Java 8
-#        uses: actions/setup-java@v3
-#        with:
-#          distribution: temurin
-#          java-version: 8
-#
-#      - name: Cache Coursier cache
-#        uses: coursier/cache-action@v6
-#
-#      - name: Publish
-#        run: |-
-#          eval "$(ssh-agent -s)"
-#          echo $SCP_SECRET | base64 -d > /tmp/id_rsa
-#          chmod 600 /tmp/id_rsa
-#          ssh-add /tmp/id_rsa
-#          cp .jvmopts-ci .jvmopts
-#          sbt docs/publishRsync
-#        env:
-#          SCP_SECRET: ${{ secrets.SCP_SECRET }}
+      - name: Build Documentation
+        run: |-
+          sbt docs/paradox unidoc
+
+      # Create directory structure upfront since rsync does not create 
intermediate directories otherwise
+      - name: Create nightly directory structure
+        run: |-
+          mkdir -p target/nightly-docs/docs/pekko-grpc/${{ github.ref_name 
}}-snapshot/
+          mv docs/target/paradox/site/main/ 
target/nightly-docs/docs/pekko-grpc/${{ github.ref_name }}-snapshot/docs
+          mv target/scala-2.12/unidoc target/nightly-docs/docs/pekko-grpc/${{ 
github.ref_name }}-snapshot/api
+
+      - name: Upload nightly docs
+        uses: ./.github/actions/sync-nightlies
+        with:
+          upload: true
+          switches: --archive --compress --update --delete --progress 
--relative
+          local_path: target/nightly-docs/./docs/pekko-grpc/ # The 
intermediate dot is to show `--relative` which paths to operate on
+          remote_path: ${{ secrets.NIGHTLIES_RSYNC_PATH }}/pekko/
+          remote_host: ${{ secrets.NIGHTLIES_RSYNC_HOST }}
+          remote_port: ${{ secrets.NIGHTLIES_RSYNC_PORT }}
+          remote_user: ${{ secrets.NIGHTLIES_RSYNC_USER }}
+          remote_key: ${{ secrets.NIGHTLIES_RSYNC_KEY }}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to