Forráskód Böngészése

set up CI workflow to deploy docs

Dan Allen 3 éve
szülő
commit
7cea7b49aa
4 módosított fájl, 53 hozzáadás és 1 törlés
  1. 18 0
      .github/actions/publish-docs.sh
  2. 28 0
      .github/workflows/deploy-docs.yml
  3. 6 0
      .sdkmanrc
  4. 1 1
      build.gradle

+ 18 - 0
.github/actions/publish-docs.sh

@@ -0,0 +1,18 @@
+#!/bin/bash
+
+HOST="$1"
+HOST_PATH="$2"
+SSH_PRIVATE_KEY="$3"
+SSH_KNOWN_HOST="$4"
+SSH_PRIVATE_KEY_PATH="$HOME/.ssh-ci/${GITHUB_REPOSITORY:-publish-docs}"
+
+if [ "$#" -ne 4 ]; then
+  echo -e "not enough arguments USAGE:\n\n$0 \$HOST \$HOST_PATH \$SSH_PRIVATE_KEY \$SSH_KNOWN_HOSTS\n\n" >&2
+  exit 1
+fi
+
+install -m 600 -D /dev/null "$SSH_PRIVATE_KEY_PATH"
+echo "$SSH_PRIVATE_KEY" > "$SSH_PRIVATE_KEY_PATH"
+echo "$SSH_KNOWN_HOST" > ~/.ssh/known_hosts
+rsync --delete -avze "ssh -i $SSH_PRIVATE_KEY_PATH" docs/build/site/ "$HOST:$HOST_PATH"
+rm -f "$SSH_PRIVATE_KEY_PATH"

+ 28 - 0
.github/workflows/deploy-docs.yml

@@ -0,0 +1,28 @@
+name: Deploy Docs
+on:
+  workflow_dispatch:
+permissions: read-all
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    #if: github.repository_owner == 'spring-projects'
+    steps:
+    - name: Checkout
+      uses: actions/checkout@v2
+      with:
+        fetch-depth: 5
+    - name: Set Up Gradle
+      uses: spring-io/spring-gradle-build-action@v1
+      with:
+        java-version: '17'
+        distribution: temurin
+    - name: Scrub Gradle Cache
+      # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions.
+      # Restoring these files from a GitHub Actions cache might cause problems for future builds.
+      run: |
+        rm -f /home/runner/.gradle/caches/modules-2/modules-2.lock
+        rm -f /home/runner/.gradle/caches/modules-2/gc.properties
+    - name: Run Antora
+      run: ./gradlew antora
+    - name: Publish Docs
+      run: ${GITHUB_WORKSPACE}/.github/actions/publish-docs.sh "${{ secrets.DOCS_USERNAME }}@${{ secrets.DOCS_HOST }}" /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/ "${{ secrets.DOCS_SSH_KEY }}" "${{ secrets.DOCS_SSH_HOST_KEY }}"

+ 6 - 0
.sdkmanrc

@@ -0,0 +1,6 @@
+# Use sdkman to run "sdk env" to initialize with correct JDK version
+# Enable auto-env through the sdkman_auto_env config
+# See https://sdkman.io/usage#config
+# A summary is to add the following to ~/.sdkman/etc/config
+# sdkman_auto_env=true
+java=17.0.3-tem

+ 1 - 1
build.gradle

@@ -11,7 +11,7 @@ node {
 
 antora {
 	antoraVersion = "3.1.0"
-	arguments = ["--fetch", "--stacktrace"]
+	arguments = ["--clean", "--fetch", "--stacktrace"]
 }
 
 tasks.antora {