add branch to run gh action on #3
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish docs | ||
on: | ||
push: | ||
branches: | ||
- collector-extension | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
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: Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: temurin | ||
java-version: 11 | ||
- name: Setup gradle | ||
uses: gradle/gradle-build-action@v2 | ||
- name: Execute gradle build to run antora | ||
run: ./gradlew antora | ||
- name: "Switch antora.yml" | ||
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 | ||
cd $GITHUB_WORKSPACE | ||
# - name: "Generate site using antora site action" | ||
# uses: riptano/antora-site-action@main | ||
# with: | ||
# antora_playbook: playbooks/site-publish-stargate-ghaction.yaml | ||
# - name: "List folder" | ||
# run: | | ||
# ls -ltra $GITHUB_WORKSPACE/build/$SITE_DIR/$SUB_DIR/develop | ||
# - 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: "Copy index.html required for website" | ||
# run: | | ||
# sudo mv $GITHUB_WORKSPACE/index.html $GITHUB_WORKSPACE/build/$SITE_DIR | ||
# ls -ltra $GITHUB_WORKSPACE/build/$SITE_DIR | ||
- 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@v3 | ||
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: peaceiris/actions-gh-pages@v3 | ||
with: | ||
personal_token: "${{ secrets.PUBLISH_STARGATE_DOCS }}" | ||
external_repository: stargate/website | ||
publish_branch: 'gh-pages' | ||
publish_dir: "${{ env.SITE_DIR }}" | ||
destination_dir: docs | ||
disable_nojekyll: true |