Skip to content

Documentation Upload #9

Documentation Upload

Documentation Upload #9

name: Documentation Upload
on:
workflow_dispatch:
inputs:
releaseVersion:
description: "Release version (5.0.x)"
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Capture release version
run: echo RELEASE_VERSION=${{ github.event.inputs.releaseVersion }} >> $GITHUB_ENV
- name: Checkout source code
uses: actions/checkout@v3
with:
ref: '5.0.x'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
- name: Update release version
run: mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$RELEASE_VERSION
- name: Generate Java docs
run: mvn javadoc:aggregate
- name: Generate Reference docs
working-directory: spring-batch-docs
run: mvn site
- name: Setup SSH key
env:
DOCS_SSH_KEY: ${{ secrets.DOCS_SSH_KEY }}
DOCS_SSH_HOST_KEY: ${{ secrets.DOCS_SSH_HOST_KEY }}
run: |
mkdir "$HOME/.ssh"
echo "$DOCS_SSH_KEY" > "$HOME/.ssh/key"
chmod 600 "$HOME/.ssh/key"
echo "$DOCS_SSH_HOST_KEY" > "$HOME/.ssh/known_hosts"
- name: Deploy docs and xsd schemas
env:
DOCS_HOST: ${{ secrets.DOCS_HOST }}
DOCS_PATH: ${{ secrets.DOCS_PATH }}
BATCH_SCHEMA_PATH: ${{ secrets.BATCH_SCHEMA_PATH }}
INTEGRATION_SCHEMA_PATH: ${{ secrets.INTEGRATION_SCHEMA_PATH }}
DOCS_USERNAME: ${{ secrets.DOCS_USERNAME }}
working-directory: spring-batch-docs/target
run: |
unzip spring-batch-$RELEASE_VERSION-docs.zip
ssh -i $HOME/.ssh/key $DOCS_USERNAME@$DOCS_HOST "cd $DOCS_PATH && mkdir -p $RELEASE_VERSION/api"
scp -i $HOME/.ssh/key -r api $DOCS_USERNAME@$DOCS_HOST:$DOCS_PATH/$RELEASE_VERSION/api
scp -i $HOME/.ssh/key -r reference $DOCS_USERNAME@$DOCS_HOST:$DOCS_PATH/$RELEASE_VERSION
ssh -i $HOME/.ssh/key $DOCS_USERNAME@$DOCS_HOST "cd $DOCS_PATH && rm 5.0.x && ln -s $RELEASE_VERSION 5.0.x"
unzip spring-batch-$RELEASE_VERSION-schemas.zip
scp -i $HOME/.ssh/key batch/*.xsd $DOCS_USERNAME@$DOCS_HOST:$BATCH_SCHEMA_PATH
scp -i $HOME/.ssh/key batch-integration/*.xsd $DOCS_USERNAME@$DOCS_HOST:$INTEGRATION_SCHEMA_PATH