-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c2264a
commit c644353
Showing
2 changed files
with
136 additions
and
8 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
name: 'Build and publish Writerside GitHub Pages' | ||
|
||
# This workflow can be reused by other workflows | ||
on: | ||
workflow_call: | ||
inputs: | ||
instance: | ||
description: 'Instance identifier (e.g., Writerside/hi)' | ||
required: true | ||
type: string | ||
docker_version: | ||
description: 'Docker version to use' | ||
required: false | ||
default: '243.22562' | ||
branches: | ||
description: 'Branches to trigger on push' | ||
required: false | ||
type: array | ||
default: ['main'] | ||
paths: | ||
description: 'Paths to watch for changes' | ||
required: false | ||
type: array | ||
default: ['Writerside/*'] | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
pages: write | ||
|
||
env: | ||
INSTANCE: ${{ inputs.instance }} | ||
DOCKER_VERSION: ${{ inputs.docker_version }} | ||
|
||
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 outputs | ||
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 }} | ||
artifact: ${{ steps.define-ids.outputs.artifact }} | ||
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 | ||
|
||
test: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: docs | ||
path: artifacts | ||
|
||
- name: Test documentation | ||
uses: JetBrains/writerside-checker-action@v1 | ||
with: | ||
instance: ${{ inputs.instance }} | ||
|
||
deploy: | ||
needs: [build, test] | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: docs | ||
path: artifacts | ||
|
||
- name: Unzip artifact | ||
run: unzip -O UTF-8 -qq "artifacts/${{ needs.build.outputs.artifact }}" -d dir | ||
|
||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
|
||
- name: Package and upload Pages artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: dir | ||
|
||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 | ||
|
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