Add GitHub action for Antora build
This commit is contained in:
71
.github/workflows/antora-site.yml
vendored
Normal file
71
.github/workflows/antora-site.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
name: 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
|
||||
jobs:
|
||||
build:
|
||||
if: github.repository_owner == 'spring-projects'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 5
|
||||
- name: Set up JDK 17
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '17'
|
||||
distribution: 'temurin'
|
||||
- name: Setup Maven Action
|
||||
uses: s4u/setup-maven-action@v1.8.0
|
||||
with:
|
||||
java-version: 17
|
||||
- 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@v3
|
||||
with:
|
||||
path: |
|
||||
node
|
||||
node_modules
|
||||
package.json
|
||||
package-lock.json
|
||||
key: ${{ runner.os }}-nodejs-${{ hashFiles('pom.xml') }}
|
||||
- name: Run Antora
|
||||
run: ./mvnw -B antora -Dspring-data.module=${{ github.event.inputs.module }}
|
||||
- name: Archive results
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: antora-site-${{ github.event.inputs.module }}
|
||||
path: target/antora/site
|
||||
retention-days: 5
|
||||
# - name: Publish Docs
|
||||
# uses: spring-io/spring-doc-actions/rsync-antora-reference@v0.0.11
|
||||
# with:
|
||||
# docs-username: ${{ secrets.DOCS_USERNAME }}
|
||||
# docs-host: ${{ secrets.DOCS_HOST }}
|
||||
# docs-ssh-key: ${{ secrets.DOCS_SSH_KEY }}
|
||||
# docs-ssh-host-key: ${{ secrets.DOCS_SSH_HOST_KEY }}
|
||||
# site-path: target/antora/site
|
||||
# httpdocs-path: /spring-data/${{ github.event.inputs.module }}/reference
|
||||
# - name: Bust Cloudflare Cache
|
||||
# uses: spring-io/spring-doc-actions/bust-cloudflare-antora-cache@v0.0.11
|
||||
# with:
|
||||
# context-root: spring-data/${{ github.event.inputs.module }}
|
||||
# cloudflare-zone-id: ${{ secrets.CLOUDFLARE_ZONE_ID }}
|
||||
# cloudflare-cache-token: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }}
|
||||
Reference in New Issue
Block a user