From 9f5534d474092aeeb3bbb57a2bb4a127e27d42e1 Mon Sep 17 00:00:00 2001 From: momijizukamori Date: Sun, 4 Feb 2024 16:54:27 -0500 Subject: [PATCH] dummy commit (#81) Refactor pages deploy workflow --------- Co-authored-by: Cocoa --- .github/workflows/pages.yml | 16 ++++++--------- .github/workflows/test-pages.yml | 35 ++++++++------------------------ README.md | 2 +- 3 files changed, 15 insertions(+), 38 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 2a6f500..b0d7e7c 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -11,7 +11,7 @@ on: # Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages permissions: - contents: read + contents: write pages: write id-token: write @@ -39,13 +39,9 @@ jobs: run: npm install - name: Build run: npm run build - - name: Setup Pages - uses: actions/configure-pages@v3 - - name: Upload artifact - uses: actions/upload-pages-artifact@v2 + - name: Deploy 🚀 + uses: JamesIves/github-pages-deploy-action@v4 with: - # Upload dist repository - path: './dist' - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v2 \ No newline at end of file + folder: dist # The folder the action should deploy. + clean-exclude: pr-preview/ + force: false \ No newline at end of file diff --git a/.github/workflows/test-pages.yml b/.github/workflows/test-pages.yml index 1945b71..6b9f4b8 100644 --- a/.github/workflows/test-pages.yml +++ b/.github/workflows/test-pages.yml @@ -13,7 +13,7 @@ on: # Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages permissions: - contents: read + contents: write pages: write id-token: write pull-requests: write @@ -25,20 +25,11 @@ concurrency: jobs: # Single deploy job since we're just deploying - deploy: + deploy-preview: runs-on: ubuntu-latest steps: - - name: update PR - if: ${{ github.event_name == 'pull_request' }} - uses: thollander/actions-comment-pull-request@v2 - with: - message: | - Started attempt to build a new deploy preview for PR ${{ github.event.pull_request.number }}. - comment_tag: pr_published - name: Checkout uses: actions/checkout@v4 - with: - ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }} - name: Set up Node uses: actions/setup-node@v3 with: @@ -47,20 +38,10 @@ jobs: - name: Install dependencies run: npm install - name: Build - run: npm run build - - name: Deploy to Server - uses: easingthemes/ssh-deploy@main - with: - SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} - ARGS: "-rlgoDzvc -i --delete" - SOURCE: "dist/" - REMOTE_HOST: ${{ secrets.REMOTE_HOST }} - REMOTE_USER: ${{ secrets.REMOTE_USER }} - TARGET: ${{ secrets.REMOTE_TARGET }}${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.event_name == 'push' && 'main' || github.event.inputs.destination}} - - name: update PR - if: ${{ github.event_name == 'pull_request' }} - uses: thollander/actions-comment-pull-request@v2 + run: npm run build -- --base=https://momijizukamori.github.io/bookbinder-js/pr-preview/${{ github.event.pull_request.number }} + if: github.event.action != 'closed' + - uses: rossjrw/pr-preview-action@v1 with: - message: | - Created a new deploy preview for PR ${{ github.event.pull_request.number }}. [See preview](https://seam.rip/bookbinder-js/${{ github.event.pull_request.number }}/). - comment_tag: pr_published \ No newline at end of file + source-dir: dist + umbrella-dir: pr-preview + action: auto \ No newline at end of file diff --git a/README.md b/README.md index dc972f1..e1aeee5 100644 --- a/README.md +++ b/README.md @@ -26,4 +26,4 @@ In the [`/docs`](/docs) directory: - A basic export of the different layouts with proportional/snug settings have been recorded for comparison/reference as well as several shots of `centered` settings. These can be found in the [`/docs/examples`](/docs/examples) folder. Snapshot of layout proof summary as of 2022-08-14 -![Snapshot of layout proof summary 2022-08-14](/docs/examples_summary_snapshot_2022_08_14.png) \ No newline at end of file +![Snapshot of layout proof summary 2022-08-14](/docs/examples_summary_snapshot_2022_08_14.png)