|
| 1 | +# A GitHub action for building a Writerside docs artifacts in a Docker container |
| 2 | + |
| 3 | +This action creates a zip-archive with HTMLs from markdown or semantic markup topics. |
| 4 | + |
| 5 | +## Environment variables |
| 6 | + |
| 7 | +### `ARTIFACT` |
| 8 | + |
| 9 | +The name of the archive is webHelpXX2-all.zip where XX gets replaced by the instance id in caps. |
| 10 | + |
| 11 | +### `PRODUCT` |
| 12 | + |
| 13 | +The $PRODUCT should be name_of_module / instance_id, for example sample_module/sd. No default value. |
| 14 | + |
| 15 | +## Example usage with the build HTMLs only |
| 16 | + |
| 17 | +```yml |
| 18 | +name: Build docs |
| 19 | + |
| 20 | +on: |
| 21 | +push: |
| 22 | +branches: ["main"] |
| 23 | + |
| 24 | +workflow_dispatch: |
| 25 | + |
| 26 | +env: |
| 27 | +PRODUCT: module/instance-id |
| 28 | +ARTIFACT: webHelpXX2-all.zip |
| 29 | + |
| 30 | +jobs: |
| 31 | +build-job: |
| 32 | +runs-on: ubuntu-latest |
| 33 | +steps: |
| 34 | +- name: Checkout repository |
| 35 | +uses: actions/checkout@v3 |
| 36 | +- name: Build Writerside docs with docker |
| 37 | +uses: JetBrains/writerside-github-action@v1 |
| 38 | +- name: Upload artifact |
| 39 | +uses: actions/upload-artifact@v3 |
| 40 | +with: |
| 41 | +name: artifact |
| 42 | +path: artifacts/${{ env.ARTIFACT }} |
| 43 | +retention-days: 7 |
| 44 | +``` |
| 45 | +
|
| 46 | +
|
| 47 | +## Example usage with build and publish to GitHub pages |
| 48 | +
|
| 49 | +```yml |
| 50 | +name: Build docs |
| 51 | + |
| 52 | +on: |
| 53 | +push: |
| 54 | +branches: ["main"] |
| 55 | + |
| 56 | +workflow_dispatch: |
| 57 | + |
| 58 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 59 | +permissions: |
| 60 | +contents: read |
| 61 | +pages: write |
| 62 | +id-token: write |
| 63 | + |
| 64 | +env: |
| 65 | + PRODUCT: module/instance-id |
| 66 | + ARTIFACT: webHelpXX2-all.zip |
| 67 | + |
| 68 | +jobs: |
| 69 | + build-job: |
| 70 | + runs-on: ubuntu-latest |
| 71 | + steps: |
| 72 | + - name: Checkout repository |
| 73 | + uses: actions/checkout@v3 |
| 74 | + - name: Build Writerside docs with docker |
| 75 | + uses: JetBrains/writerside-github-action@v1 |
| 76 | + - name: Upload artifact |
| 77 | + uses: actions/upload-artifact@v3 |
| 78 | + with: |
| 79 | + name: artifact |
| 80 | + path: artifacts/${{ env.ARTIFACT }} |
| 81 | + retention-days: 7 |
| 82 | + |
| 83 | +deploy: |
| 84 | + environment: |
| 85 | + name: github-pages |
| 86 | + url: ${{ steps.deployment.outputs.page_url }} |
| 87 | + needs: build-job |
| 88 | + runs-on: ubuntu-latest |
| 89 | + steps: |
| 90 | + - name: Download artifact |
| 91 | + uses: actions/download-artifact@v3 |
| 92 | + with: |
| 93 | + name: artifact |
| 94 | + - name: Unzip artifact |
| 95 | + uses: montudor/action-zip@v1 |
| 96 | + with: |
| 97 | + args: unzip -qq ${{ env.ARTIFACT }} -d dir |
| 98 | + - name: Setup Pages |
| 99 | + uses: actions/configure-pages@v2 |
| 100 | + - name: Upload artifact |
| 101 | + uses: actions/upload-pages-artifact@v1 |
| 102 | + with: |
| 103 | + path: dir |
| 104 | + - name: Deploy to GitHub Pages |
| 105 | + id: deployment |
| 106 | + uses: actions/deploy-pages@v1 |
| 107 | + |
| 108 | +``` |
0 commit comments