Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
ci: publish documentation to Cloudflare Pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Dwigoric committed Dec 11, 2023
1 parent 8542893 commit fb86cf5
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 40 deletions.
43 changes: 3 additions & 40 deletions .github/workflows/deployment_azure-app-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ name: Deploy Node.js express app to Azure Web App - compact-donuts

on:
push:
paths-ignore:
- 'docs/**'
branches:
- main
- 'Sprint-[0-9]*'
Expand All @@ -15,11 +17,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
WRS_INSTANCE: docs/ucwa
WRS_ARTIFACT: webHelpUCWA2-all.zip
WRS_DOCKER_VERSION: 232.10275

jobs:
deploy:
runs-on: ubuntu-latest
Expand All @@ -42,42 +39,8 @@ jobs:
echo 'Install dependencies'
yarn install --immutable
- name: Build jsdoc documentation
uses: andstor/jsdoc-action@v1
with:
source_dir: .
recurse: true
output_dir: ./public/docs/jsdoc

- name: Build Writerside docs using Docker
uses: JetBrains/writerside-github-action@v4
with:
instance: ${{ env.WRS_INSTANCE }}
artifact: ${{ env.WRS_ARTIFACT }}
docker-version: ${{ env.WRS_DOCKER_VERSION }}

- name: Upload Writerside documentation artifact
uses: actions/upload-artifact@v3
with:
name: wrs_docs
path: |
artifacts/${{ env.WRS_ARTIFACT }}
artifacts/report.json
retention-days: 7

- name: Test Writerside documentation
uses: JetBrains/writerside-checker-action@v1
with:
instance: ${{ env.WRS_INSTANCE }}

- name: Unzip Writerside artifact
uses: montudor/action-zip@v1
with:
args: unzip -qq artifacts/${{ env.WRS_ARTIFACT }} -d ./public/docs/code

- name: Remove unused files and folders
- name: Remove docs folder from repo
run: |
sudo rm -rf artifacts
git rm -rf docs
- name: 'Deploy to Azure Web App'
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/docs-cf-pages-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Publish Writerside and JSDoc documentation to Cloudflare Pages

on:
push:
branches:
- main
- 'Sprint-[0-9]*'
- 'patch-[0-9]*'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
WRS_INSTANCE: docs/ucwa
WRS_ARTIFACT: webHelpUCWA2-all.zip
WRS_DOCKER_VERSION: 232.10275

jobs:
publish:
runs-on: ubuntu-latest
environment:
name: 'Documentation'
url: ${{ steps.deploy-to-cloudflare-pages.outputs.url }}
permissions:
contents: read
deployments: write

name: Publish to Cloudflare Pages
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build jsdoc documentation
uses: andstor/jsdoc-action@v1
with:
source_dir: .
recurse: true
output_dir: ./built_docs/jsdoc

- name: Build Writerside docs using Docker
uses: JetBrains/writerside-github-action@v4
with:
instance: ${{ env.WRS_INSTANCE }}
artifact: ${{ env.WRS_ARTIFACT }}
docker-version: ${{ env.WRS_DOCKER_VERSION }}

- name: Upload Writerside documentation artifact
uses: actions/upload-artifact@v3
with:
name: wrs_docs
path: |
artifacts/${{ env.WRS_ARTIFACT }}
artifacts/report.json
retention-days: 7

- name: Test Writerside documentation
uses: JetBrains/writerside-checker-action@v1
with:
instance: ${{ env.WRS_INSTANCE }}

- name: Unzip Writerside artifact
uses: montudor/action-zip@v1
with:
args: unzip -qq artifacts/${{ env.WRS_ARTIFACT }} -d ./built_docs/code

- name: Publish to Cloudflare Pages
uses: cloudflare/pages-action@1
id: deploy-to-cloudflare-pages
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
directory: built_docs
gitHubToken: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit fb86cf5

Please sign in to comment.