Skip to content

Build and Deploy Documentation #14

Build and Deploy Documentation

Build and Deploy Documentation #14

name: Build and Deploy Documentation
on:
push:
branches:
- main
workflow_dispatch:
env:
INSTANCE: 'Writerside/strumenta'
DOCKER_VERSION: '243.21565'
jobs:
build:
runs-on: ubuntu-latest
outputs:
algolia_artifact: ${{ steps.define-ids.outputs.algolia_artifact }}
artifact: ${{ steps.define-ids.outputs.artifact }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Define instance id and artifacts
id: define-ids
run: |
INSTANCE=${INSTANCE#*/}
INSTANCE_ID_UPPER=$(echo "$INSTANCE" | tr '[:lower:]' '[:upper:]')
ARTIFACT="webHelp${INSTANCE_ID_UPPER}2-all.zip"
ALGOLIA_ARTIFACT="algolia-indexes-${INSTANCE_ID_UPPER}.zip"
# Print the values
echo "INSTANCE_ID_UPPER: $INSTANCE_ID_UPPER"
echo "ARTIFACT: $ARTIFACT"
echo "ALGOLIA_ARTIFACT: $ALGOLIA_ARTIFACT"
# Set the environment variables and outputs
echo "INSTANCE_ID_UPPER=$INSTANCE_ID_UPPER" >> $GITHUB_ENV
echo "ARTIFACT=$ARTIFACT" >> $GITHUB_ENV
echo "ALGOLIA_ARTIFACT=$ALGOLIA_ARTIFACT" >> $GITHUB_ENV
echo "artifact=$ARTIFACT" >> $GITHUB_OUTPUT
echo "algolia_artifact=$ALGOLIA_ARTIFACT" >> $GITHUB_OUTPUT
- name: Build docs using Writerside Docker builder
uses: JetBrains/writerside-github-action@v4
with:
instance: ${{ env.INSTANCE }}
docker-version: ${{ env.DOCKER_VERSION }}
- name: Save artifact with build results
uses: actions/upload-artifact@v4
with:
name: docs
path: |
artifacts/${{ steps.define-ids.outputs.artifact }}
artifacts/report.json
artifacts/${{ steps.define-ids.outputs.algolia_artifact }}
retention-days: 7
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: writerside-docs
path: artifacts/
- name: Push built documentation as a package
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Create a release version tag
RELEASE_TAG="v$(date +'%Y%m%d%H%M%S')"
echo "Release tag: $RELEASE_TAG"
# Package the built artifact and upload it to GitHub Packages
mkdir -p ./package