83 lines
3.2 KiB
YAML
83 lines
3.2 KiB
YAML
name: Commercial Antora Site
|
|
run-name: ${{ format('{0} for spring-data-{1} ({2})', github.workflow, github.event.inputs.module, github.event.inputs.build-refname || 'all') }}
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
module:
|
|
description: Enter Spring Data module suffix to build (e.g., commons, jpa).
|
|
required: true
|
|
build-refname:
|
|
description: Enter git refname to build (e.g., 5.7.x).
|
|
required: false
|
|
permissions:
|
|
contents: write
|
|
env:
|
|
ARTIFACTORY_USR: ${{ secrets.COMMERCIAL_ARTIFACTORY_RO_USERNAME }}
|
|
ARTIFACTORY_PSW: ${{ secrets.COMMERCIAL_ARTIFACTORY_RO_PASSWORD }}
|
|
jobs:
|
|
build:
|
|
if: github.repository_owner == 'spring-projects'
|
|
runs-on: ubuntu22-2-8
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4.2.2
|
|
with:
|
|
fetch-depth: 5
|
|
- name: Set up JDK 17
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
java-version: '17'
|
|
distribution: 'temurin'
|
|
- name: Setup Maven Action
|
|
uses: s4u/setup-maven-action@v1.16.0
|
|
with:
|
|
java-version: 17
|
|
- name: Set up Maven
|
|
run: |
|
|
mkdir -p ~/.m2
|
|
rm -f ~/.m2/settings.xml
|
|
cp settings.xml ~/.m2/settings.xml
|
|
- name: Setup Git Credentials for Antora
|
|
run: echo "https://${{ secrets.GH_ACTIONS_REPO_TOKEN }}:@github.com" >> ~/.git-credentials
|
|
- name: Set up refname build
|
|
if: github.event.inputs.build-refname
|
|
run: |
|
|
git fetch --depth 1 https://github.com/spring-projects/spring-data-${{ github.event.inputs.module }} ${{ github.event.inputs.build-refname }}
|
|
export BUILD_REFNAME=${{ github.event.inputs.build-refname }}
|
|
echo "BUILD_REFNAME=$BUILD_REFNAME" >> $GITHUB_ENV
|
|
export BUILD_VERSION=$(git cat-file --textconv FETCH_HEAD:pom.xml | python3 -c "import xml.etree.ElementTree as xml; from sys import stdin; print(xml.parse(stdin).getroot().find('{http://maven.apache.org/POM/4.0.0}version').text)")
|
|
echo BUILD_VERSION=$BUILD_VERSION >> $GITHUB_ENV
|
|
- name: Cache nodejs
|
|
uses: actions/cache@v4.2.0
|
|
with:
|
|
path: |
|
|
node
|
|
node_modules
|
|
package.json
|
|
package-lock.json
|
|
key: ${{ runner.os }}-nodejs-${{ hashFiles('pom.xml') }}
|
|
- name: Cache Maven
|
|
uses: actions/cache@v4.2.0
|
|
with:
|
|
path: ~/.m2
|
|
key: ${{ runner.os }}-maven-${{ github.event.inputs.module }}
|
|
restore-keys: ${{ runner.os }}-maven
|
|
- name: Cache Antora
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/.cache
|
|
key: ${{ runner.os }}-antora-${{ github.event.inputs.module }}-${{ hashFiles('**/*.yml') }}
|
|
restore-keys: ${{ runner.os }}-antora-${{ github.event.inputs.module }}
|
|
- name: Run Antora
|
|
run: ./mvnw -B antora -Dvariant=commercial -Dspring-data.module=${{ github.event.inputs.module }}
|
|
- name: 'Authenticate to docs.spring.vmware.com'
|
|
uses: 'google-github-actions/auth@v2.1.0'
|
|
with:
|
|
credentials_json: '${{ secrets.COMMERCIAL_DOCS_GCP_BUCKET_JSON }}'
|
|
- name: 'Publish Docs to docs.spring.vmware.com'
|
|
uses: 'google-github-actions/upload-cloud-storage@v2.1.0'
|
|
with:
|
|
path: 'target/antora/site'
|
|
destination: 'docs.spring.vmware.com/spring-data/${{ github.event.inputs.module }}/reference'
|
|
parent: false
|