set up CI workflow to deploy docs

This commit is contained in:
Dan Allen 2022-09-01 14:03:36 -06:00
parent c993da749c
commit 7cea7b49aa
4 changed files with 53 additions and 1 deletions

18
.github/actions/publish-docs.sh vendored Normal file
View File

@ -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
.github/workflows/deploy-docs.yml vendored Normal file
View File

@ -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
.sdkmanrc Normal file
View File

@ -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

View File

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