Skip to content

Merge pull request #271 from stargate/dependabot/github_actions/actio… #27

Merge pull request #271 from stargate/dependabot/github_actions/actio…

Merge pull request #271 from stargate/dependabot/github_actions/actio… #27

Workflow file for this run

name: Build docs with Antora
on:
push:
branches:
- main
env:
SITE_DIR: 'stargate'
SUB_DIR: 'latest'
jobs:
build_site:
name: "Build site with Antora"
runs-on: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Java for gradle
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- name: Switch antora.yml symlink
run: |
FILE=antora.yml
cd $GITHUB_WORKSPACE/docs-src/stargate-core
if [ -f "$FILE" ]; then
rm antora.yml;
echo "antora.yml removed"
fi
ln -s antora-stargate.yml antora.yml
cd $GITHUB_WORKSPACE/docs-src/stargate-develop
if [ -f "$FILE" ]; then
rm antora.yml;
echo "antora.yml removed"
fi
ln -s antora-stargate.yml antora.yml
- name: Setup gradle
uses: gradle/gradle-build-action@v2
- name: Execute gradle build to run antora
run: ./gradlew antora
- name: "Fix attachments"
run: |
sudo mv $GITHUB_WORKSPACE/build/$SITE_DIR/$SUB_DIR/develop/_attachments $GITHUB_WORKSPACE/build/$SITE_DIR/$SUB_DIR/develop/attachments
sudo sed -i 's/_attachments/attachments/g' $GITHUB_WORKSPACE/build/$SITE_DIR/$SUB_DIR/develop/api.html
ls -ltra $GITHUB_WORKSPACE/build/$SITE_DIR
grep attachment $GITHUB_WORKSPACE/build/$SITE_DIR/$SUB_DIR/develop/api.html
- name: Upload generated site
uses: actions/upload-artifact@v3
with:
name: site
path: "${{ github.workspace }}/build/${{ env.SITE_DIR }}"
deploy_site:
runs-on: [ubuntu-latest]
needs: [build_site]
name: "Deploy GitHub Pages"
steps:
- name: Setup Node.js for use with actions
uses: actions/setup-node@v4
with:
node-version: 16
- name: Checkout
uses: actions/checkout@v3
- name: Download generated site
uses: actions/download-artifact@v3
with:
name: site
path: "${{ github.workspace }}/${{ env.SITE_DIR }}"
- name: Deploy to GitHub Pages
uses: JamesIves/[email protected]
with:
# ACCESS_TOKEN: # optional
token: "${{ github.token}}"
folder: "${{ env.SITE_DIR }}"
branch: 'gh-pages'
commit-message: "[CI] Publish documentation for ${{ github.sha }}"