From d7f2e2f4c232fc8e61fdcb51053bc09bbc10ef16 Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Tue, 26 Sep 2023 15:12:39 +0800 Subject: [PATCH 1/9] chore(ci): support to comment with deployed url --- .github/workflows/preview-docs-deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview-docs-deployment.yaml b/.github/workflows/preview-docs-deployment.yaml index 81eedd16..9a2299d2 100644 --- a/.github/workflows/preview-docs-deployment.yaml +++ b/.github/workflows/preview-docs-deployment.yaml @@ -53,7 +53,7 @@ jobs: - name: Push to Netlify timeout-minutes: 10 working-directory: docs/ - run: netlify deploy --dir .vitepress/dist + run: netlify deploy --dir .vitepress/dist --json env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} From cf0c3ab6d22985301a8a9dfddfe1f533c003b379 Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Tue, 26 Sep 2023 16:00:48 +0800 Subject: [PATCH 2/9] chore(ci): process outputs --- .../workflows/preview-docs-deployment.yaml | 36 ++++++++++++++++++- .test | 1 + 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 .test diff --git a/.github/workflows/preview-docs-deployment.yaml b/.github/workflows/preview-docs-deployment.yaml index 9a2299d2..d056a851 100644 --- a/.github/workflows/preview-docs-deployment.yaml +++ b/.github/workflows/preview-docs-deployment.yaml @@ -10,6 +10,27 @@ jobs: name: Build runs-on: ubuntu-22.04 steps: + - name: Find Comment + uses: peter-evans/find-comment@v2 + id: fc + with: + issue-number: ${{ github.event.pull_request.number }} + comment-author: 'github-actions[bot]' + body-includes: Previewing with Netlify + + - name: Create or update comment + uses: peter-evans/create-or-update-comment@v3 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + body: | + ## Previewing with Netlify + + | Status | URL | + |-------------|-------| + | 🚧 Deploying | | + edit-mode: replace + - name: Checkout uses: actions/checkout@v3 with: @@ -51,10 +72,23 @@ jobs: run: pnpm install -g netlify-cli - name: Push to Netlify + id: netlify timeout-minutes: 10 working-directory: docs/ - run: netlify deploy --dir .vitepress/dist --json + run: cho "NETLIFY_OUTPUT=$(netlify deploy --dir .vitepress/dist --json)" >> $GITHUB_ENV env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + - name: Create or update comment + uses: peter-evans/create-or-update-comment@v3 + with: + comment-id: ${{ steps.fc.outputs.comment-id }} + issue-number: ${{ github.event.pull_request.number }} + body: | + ## Previewing with Netlify + + | Status | URL | + |-------------|----------------------------------------------------------| + | 🚧 Deploying | ${{fromJSON(steps.netlify.outputs.NETLIFY_OUTPUT)}} | + edit-mode: replace diff --git a/.test b/.test new file mode 100644 index 00000000..8f0b016c --- /dev/null +++ b/.test @@ -0,0 +1 @@ +TEST_RESULT={} From cfa94abe7714b97464131a3ea6d47bf7a1a46567 Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Tue, 26 Sep 2023 16:17:32 +0800 Subject: [PATCH 3/9] chore(ci): process outputs --- .github/workflows/preview-docs-deployment.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/preview-docs-deployment.yaml b/.github/workflows/preview-docs-deployment.yaml index d056a851..0c16b7b1 100644 --- a/.github/workflows/preview-docs-deployment.yaml +++ b/.github/workflows/preview-docs-deployment.yaml @@ -8,6 +8,8 @@ on: jobs: build: name: Build + permissions: + pull-requests: write runs-on: ubuntu-22.04 steps: - name: Find Comment From 7ba1e1e21aeb46a982a2dec91a8f0551fe7796c8 Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Tue, 26 Sep 2023 16:25:35 +0800 Subject: [PATCH 4/9] chore(ci): process outputs --- .../workflows/preview-docs-deployment.yaml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/preview-docs-deployment.yaml b/.github/workflows/preview-docs-deployment.yaml index 0c16b7b1..028afeaa 100644 --- a/.github/workflows/preview-docs-deployment.yaml +++ b/.github/workflows/preview-docs-deployment.yaml @@ -18,7 +18,7 @@ jobs: with: issue-number: ${{ github.event.pull_request.number }} comment-author: 'github-actions[bot]' - body-includes: Previewing with Netlify + body-includes: to Netlify - name: Create or update comment uses: peter-evans/create-or-update-comment@v3 @@ -26,11 +26,11 @@ jobs: comment-id: ${{ steps.fc.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} body: | - ## Previewing with Netlify + ## 🚧 Deploying to Netlify - | Status | URL | - |-------------|-------| - | 🚧 Deploying | | + | Status | URL | + |-------------|--------------------------------------| + | Pending | `URL will be revealed once deployed` | edit-mode: replace - name: Checkout @@ -77,7 +77,7 @@ jobs: id: netlify timeout-minutes: 10 working-directory: docs/ - run: cho "NETLIFY_OUTPUT=$(netlify deploy --dir .vitepress/dist --json)" >> $GITHUB_ENV + run: echo "NETLIFY_OUTPUT=$(netlify deploy --dir .vitepress/dist --json)" >> $GITHUB_ENV env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} @@ -88,9 +88,9 @@ jobs: comment-id: ${{ steps.fc.outputs.comment-id }} issue-number: ${{ github.event.pull_request.number }} body: | - ## Previewing with Netlify + ## ✅ Deployed to Netlify - | Status | URL | - |-------------|----------------------------------------------------------| - | 🚧 Deploying | ${{fromJSON(steps.netlify.outputs.NETLIFY_OUTPUT)}} | + | Status | URL | + |-------------|-----------------------------------------------------| + | Success | ${{fromJSON(steps.netlify.outputs.NETLIFY_OUTPUT)}} | edit-mode: replace From ff0cfd401dbf1a287ed7baf2aea73bd21e78a91c Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Tue, 26 Sep 2023 16:31:38 +0800 Subject: [PATCH 5/9] chore(ci): process outputs --- .github/workflows/preview-docs-deployment.yaml | 3 ++- .test | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) delete mode 100644 .test diff --git a/.github/workflows/preview-docs-deployment.yaml b/.github/workflows/preview-docs-deployment.yaml index 028afeaa..63f55532 100644 --- a/.github/workflows/preview-docs-deployment.yaml +++ b/.github/workflows/preview-docs-deployment.yaml @@ -77,7 +77,8 @@ jobs: id: netlify timeout-minutes: 10 working-directory: docs/ - run: echo "NETLIFY_OUTPUT=$(netlify deploy --dir .vitepress/dist --json)" >> $GITHUB_ENV + run: | + echo "NETLIFY_URL=$(netlify deploy --dir .vitepress/dist --json | jq -r .deploy_url)" >> $GITHUB_ENV env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} diff --git a/.test b/.test deleted file mode 100644 index 8f0b016c..00000000 --- a/.test +++ /dev/null @@ -1 +0,0 @@ -TEST_RESULT={} From 357a47f829478e0ed1d40779767971eb678bcef8 Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Tue, 26 Sep 2023 16:34:15 +0800 Subject: [PATCH 6/9] chore(ci): process outputs --- .github/workflows/preview-docs-deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview-docs-deployment.yaml b/.github/workflows/preview-docs-deployment.yaml index 63f55532..b7be82fe 100644 --- a/.github/workflows/preview-docs-deployment.yaml +++ b/.github/workflows/preview-docs-deployment.yaml @@ -93,5 +93,5 @@ jobs: | Status | URL | |-------------|-----------------------------------------------------| - | Success | ${{fromJSON(steps.netlify.outputs.NETLIFY_OUTPUT)}} | + | Success | ${{steps.netlify.outputs.NETLIFY_URL}} | edit-mode: replace From 96f79296ab734227bc85fe6b24fdc3c50b7126f5 Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Tue, 26 Sep 2023 17:53:43 +0800 Subject: [PATCH 7/9] chore(ci): process outputs --- .github/workflows/preview-docs-deployment.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/preview-docs-deployment.yaml b/.github/workflows/preview-docs-deployment.yaml index b7be82fe..4677a187 100644 --- a/.github/workflows/preview-docs-deployment.yaml +++ b/.github/workflows/preview-docs-deployment.yaml @@ -79,6 +79,7 @@ jobs: working-directory: docs/ run: | echo "NETLIFY_URL=$(netlify deploy --dir .vitepress/dist --json | jq -r .deploy_url)" >> $GITHUB_ENV + cat $GITHUB_ENV env: NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} From 4fc9b3aa80d33a3c459f2c53ab2332b8e33543d6 Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Tue, 26 Sep 2023 18:05:24 +0800 Subject: [PATCH 8/9] chore(ci): process outputs --- .github/workflows/preview-docs-deployment.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/preview-docs-deployment.yaml b/.github/workflows/preview-docs-deployment.yaml index 4677a187..7f47e67d 100644 --- a/.github/workflows/preview-docs-deployment.yaml +++ b/.github/workflows/preview-docs-deployment.yaml @@ -94,5 +94,7 @@ jobs: | Status | URL | |-------------|-----------------------------------------------------| - | Success | ${{steps.netlify.outputs.NETLIFY_URL}} | + | Success | ${{ env.NETLIFY_URL }} | edit-mode: replace + env: + NETLIFY_URL: ${{ steps.netlify.outputs.NETLIFY_URL }} From 1dc3aacaa5c617890390b5fb0712f2fb5139d1ee Mon Sep 17 00:00:00 2001 From: Neko Ayaka Date: Tue, 26 Sep 2023 18:15:40 +0800 Subject: [PATCH 9/9] chore(ci): process outputs --- .github/workflows/preview-docs-deployment.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/preview-docs-deployment.yaml b/.github/workflows/preview-docs-deployment.yaml index 7f47e67d..71a77a69 100644 --- a/.github/workflows/preview-docs-deployment.yaml +++ b/.github/workflows/preview-docs-deployment.yaml @@ -96,5 +96,3 @@ jobs: |-------------|-----------------------------------------------------| | Success | ${{ env.NETLIFY_URL }} | edit-mode: replace - env: - NETLIFY_URL: ${{ steps.netlify.outputs.NETLIFY_URL }}