Rename the file (#2660) #59
This file contains hidden or 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: "Generate HTML" | |
# edit the list of branches according to your repository | |
# the list of branches should contain all the branches in your Antora publish playbooks | |
on: | |
push: | |
branches: | |
- 'dev' | |
- 'main' | |
- '5.x' | |
- '4.4' | |
workflow_dispatch: | |
# change `dev` and `main` according to your repository's branch names | |
# `dev` is the branch you use to build and publish to staging | |
# `main` is the branch you use to build and publish to neo4j.com/docs | |
# in some cases, PROD_BRANCH and DEV_BRANCH may be the same branch | |
env: | |
PROD_BRANCH: 'main' | |
DEV_BRANCH: 'dev' | |
jobs: | |
prepare-ref-env: | |
name: Set build branch and environments | |
runs-on: ubuntu-latest | |
outputs: | |
build-ref: ${{ steps.set-ref-env.outputs.build-ref }} | |
environments: ${{ steps.set-ref-env.outputs.environments }} | |
steps: | |
- name: Set Build Ref | |
id: set-ref-env | |
run: | | |
if [[ "${GITHUB_REF}" == "refs/heads/${{ env.DEV_BRANCH }}" ]]; then | |
build_from=${{ env.DEV_BRANCH }} | |
environments='["dev"]' | |
else | |
build_from=${{ env.PROD_BRANCH }} | |
environments='["prod"]' | |
fi | |
# if dev branch = prod branch publish to both | |
if [[ "${{ env.DEV_BRANCH }}" == "${{ env.PROD_BRANCH }}" ]]; then | |
environments='["dev","prod"]' | |
fi | |
echo "build-ref=${build_from}" >> $GITHUB_OUTPUT | |
echo "environments=${environments[@]}" >> $GITHUB_OUTPUT | |
docs-build: | |
name: Generate HTML | |
needs: prepare-ref-env | |
uses: neo4j/docs-tools/.github/workflows/reusable-docs-build.yml@v2 | |
with: | |
package-script: 'verify:publish' | |
build-ref: ${{needs.prepare-ref-env.outputs.build-ref}} | |
fetch-depth: 0 | |
docs-verify: | |
name: Verify HTML | |
needs: docs-build | |
uses: neo4j/docs-tools/.github/workflows/reusable-docs-verify.yml@v2 | |
with: | |
failOnWarnings: true | |
publish-html: | |
name: Publish HTML | |
needs: [docs-verify, prepare-ref-env] | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
environments: ${{ fromJson(needs.prepare-ref-env.outputs.environments) }} | |
steps: | |
- name: Publish to ${{ matrix.environments }} | |
uses: peter-evans/repository-dispatch@bf47d102fdb849e755b0b0023ea3e81a44b6f570 # v2.1.2 | |
with: | |
token: ${{ secrets.DOCS_DISPATCH_TOKEN }} | |
repository: neo4j/docs-publish | |
event-type: publish-html | |
client-payload: |- | |
{ | |
"org": "${{ github.repository_owner }}", | |
"repo": "${{ github.event.repository.name }}", | |
"run_id": "${{ github.run_id }}", | |
"args": "--dryrun", | |
"publish_env": "${{ matrix.environments }}" | |
} |