|
| 1 | +## |
| 2 | +# Copyright (C) 2023-2024 Hedera Hashgraph, LLC |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | +## |
| 16 | + |
| 17 | +name: Publish JsDoc |
| 18 | + |
| 19 | +on: |
| 20 | + push: |
| 21 | + branches: |
| 22 | + - 00119-jsdoc-support |
| 23 | + pull_request: |
| 24 | + |
| 25 | +jobs: |
| 26 | + deploy: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + env: |
| 29 | + PR_PATH: pull/${{github.event.number}} |
| 30 | + permissions: |
| 31 | + contents: write |
| 32 | + concurrency: |
| 33 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 34 | + steps: |
| 35 | + - name: Checkout code |
| 36 | + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 |
| 37 | + |
| 38 | + - name: Build |
| 39 | + uses: andstor/jsdoc-action@v1 |
| 40 | + with: |
| 41 | + source_dir: ./src |
| 42 | + output_dir: ./out |
| 43 | + config_file: jsdoc.conf.json |
| 44 | + template: minami |
| 45 | + front_page: README.md |
| 46 | + |
| 47 | + - name: Deploy if this is the `main` branch |
| 48 | + uses: peaceiris/actions-gh-pages@v3 |
| 49 | + if: github.ref == 'refs/heads/main' |
| 50 | + with: |
| 51 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + publish_dir: ./public |
| 53 | + |
| 54 | + |
| 55 | + - name: Set base URL for preview if PR |
| 56 | + if: github.ref != 'refs/heads/main' |
| 57 | + run: echo "BASE_URL=https://${{ env.DOMAIN }}/${{ github.event.repository.name }}/${{ env.PR_PATH}}/" >> $GITHUB_ENV |
| 58 | + |
| 59 | + - name: Deploy to PR preview |
| 60 | + uses: peaceiris/actions-gh-pages@v3 |
| 61 | + if: github.ref != 'refs/heads/main' |
| 62 | + with: |
| 63 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + publish_dir: ./out |
| 65 | + destination_dir: ${{ env.PR_PATH }} # TODO you need to set this if you're using a custom domain. Otherwise you can remove it. |
| 66 | + |
0 commit comments