diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml deleted file mode 100644 index 372b645f..00000000 --- a/.github/workflows/doc.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Documentation -on: pull_request - -jobs: - node-linters: - runs-on: ubuntu-latest - name: Build documentation - steps: - - uses: actions/checkout@master - - name: Set up Node - uses: actions/setup-node@v1 - with: - node-version: 12.x - - name: npm install - run: npm i - - name: Build documentation - run: npm run build:doc diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 00000000..c886f402 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,53 @@ +name: Documentation + +on: + pull_request: + release: + types: [published] + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + name: Build and deploy + steps: + - name: Check actor permission level + # Only allow admin to deploy on release + if: github.event.release + uses: skjnldsv/check-actor-permission@e591dbfe838300c007028e1219ca82cc26e8d7c5 # v2 + with: + require: admin + + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Read package.json node and npm engines version + uses: skjnldsv/read-package-engines-version-actions@8205673bab74a63eb9b8093402fd9e0e018663a1 # v2.2 + id: versions + with: + fallbackNode: '^20' + fallbackNpm: '^9' + + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 + with: + node-version: ${{ steps.versions.outputs.nodeVersion }} + + - name: Set up npm ${{ steps.versions.outputs.npmVersion }} + run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}" + + - name: Install dependencies & build + env: + CYPRESS_INSTALL_BINARY: 0 + run: | + npm ci + npm run build --if-present + npm run build:doc --if-present + + - name: Deploy + # Only deploy on release + if: github.event.release + uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./dist/doc