diff --git a/.github/workflows/npm-gh-pages.yml b/.github/workflows/npm-gh-pages.yml new file mode 100644 index 0000000..e6a8a37 --- /dev/null +++ b/.github/workflows/npm-gh-pages.yml @@ -0,0 +1,65 @@ +name: Deploy Mirador with GitHub Pages dependencies preinstalled + +on: + push: + branches: ["main"] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Cache node modules + id: cache-npm + uses: actions/cache@v3 + env: + cache-name: cache-node-modules + with: + path: ~/.npm + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} + name: List the state of node modules + continue-on-error: true + run: npm list + + - name: Install dependencies + run: npm install + + - name: Build + run: npm run webpack + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: ./webpack/dist + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4