From 75f49c6b09bc15abc85dec9dc01abf368a142b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6?= Date: Thu, 1 Jun 2023 17:32:13 +0200 Subject: chore: update workflows from templates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ --- .github/workflows/documentation.yml | 64 +++++++++++++++++++++++++------------ .github/workflows/lint-eslint.yml | 34 ++++++++++++++------ 2 files changed, 69 insertions(+), 29 deletions(-) diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index 9b7022748..68ed22809 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -1,25 +1,49 @@ -name: Publish docs via GitHub Pages +name: Documentation + on: - push: - branches: - - master - paths: - - 'docs/**' + pull_request: + release: + types: [published] jobs: - build: - name: Deploy docs + build-and-deploy: runs-on: ubuntu-latest + + name: Build and deploy steps: - - name: Checkout master - uses: actions/checkout@v3 - - - name: Deploy docs - uses: mhausenblas/mkdocs-deploy-gh-pages@master - # Or use mhausenblas/mkdocs-deploy-gh-pages@nomaterial to build without the mkdocs-material theme - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - #CUSTOM_DOMAIN: optionaldomain.com - #CONFIG_FILE: folder/mkdocs.yml - #EXTRA_PACKAGES: build-base - # GITHUB_DOMAIN: github.myenterprise.com \ No newline at end of file + - name: Check actor permission level + uses: skjnldsv/check-actor-permission@e591dbfe838300c007028e1219ca82cc26e8d7c5 # v2 + with: + require: admin + + - name: Checkout + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 + + - name: Read package.json node and npm engines version + uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1 + id: versions + with: + fallbackNode: '^16' + fallbackNpm: '^8' + + - name: Set up node ${{ steps.versions.outputs.nodeVersion }} + uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.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 + 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 diff --git a/.github/workflows/lint-eslint.yml b/.github/workflows/lint-eslint.yml index 54bbca3f3..508d71395 100644 --- a/.github/workflows/lint-eslint.yml +++ b/.github/workflows/lint-eslint.yml @@ -2,15 +2,31 @@ # # https://github.com/nextcloud/.github # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization - -name: Lint - -on: pull_request +# +# Use lint-eslint together with lint-eslint-when-unrelated to make eslint a required check for GitHub actions +# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks + +name: Lint eslint + +on: + pull_request: + paths: + - '.github/workflows/**' + - 'src/**' + - 'appinfo/info.xml' + - 'package.json' + - 'package-lock.json' + - 'tsconfig.json' + - '.eslintrc.*' + - '.eslintignore' + - '**.js' + - '**.ts' + - '**.vue' permissions: contents: read -concurrency: +concurrency: group: lint-eslint-${{ github.head_ref || github.run_id }} cancel-in-progress: true @@ -22,17 +38,17 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - name: Read package.json node and npm engines version - uses: skjnldsv/read-package-engines-version-actions@v2.1 + uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1 id: versions with: fallbackNode: '^16' - fallbackNpm: '^6' + fallbackNpm: '^7' - name: Set up node ${{ steps.versions.outputs.nodeVersion }} - uses: actions/setup-node@v3 + uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3 with: node-version: ${{ steps.versions.outputs.nodeVersion }} -- cgit v1.2.3