Skip to content

ci: creating github pages to host document and JsDoc #156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/flow-publish-jsdoc-github-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
##
# Copyright (C) 2023-2024 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##

name: Publish JsDoc

on:
push:
branches:
- 00119-jsdoc-support
pull_request:

jobs:
deploy:
runs-on: ubuntu-latest
env:
PR_PATH: pull/${{github.event.number}}
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Build
uses: andstor/jsdoc-action@v1
with:
source_dir: ./src
output_dir: ./out
config_file: jsdoc.conf.json
template: minami
front_page: README.md

- name: Deploy if this is the `main` branch
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public


- name: Set base URL for preview if PR
if: github.ref != 'refs/heads/main'
run: echo "BASE_URL=https://${{ env.DOMAIN }}/${{ github.event.repository.name }}/${{ env.PR_PATH}}/" >> $GITHUB_ENV

- name: Deploy to PR preview
uses: peaceiris/actions-gh-pages@v3
if: github.ref != 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./out
destination_dir: ${{ env.PR_PATH }} # TODO you need to set this if you're using a custom domain. Otherwise you can remove it.

5 changes: 5 additions & 0 deletions jsdoc.conf.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"source": {
"includePattern": ".+\\.(js(doc|x)?|mjs)$"
}
}
Loading