From e0ece311ba33d2c27ce24117a89461ab5ee0a271 Mon Sep 17 00:00:00 2001 From: Marco Braga Date: Mon, 23 Oct 2023 12:12:14 -0300 Subject: [PATCH] enable doc preview job --- .github/workflows/site-preview.yaml | 110 ++++++++++++++-------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/.github/workflows/site-preview.yaml b/.github/workflows/site-preview.yaml index 25d5cd2..32b66e6 100644 --- a/.github/workflows/site-preview.yaml +++ b/.github/workflows/site-preview.yaml @@ -15,70 +15,70 @@ jobs: steps: - uses: actions/checkout@v2 - # - name: Set job vars - # id: vars - # run: | - # echo "cache-key-npm=npm-vercel-${VERCEL_VERSION}" >> $GITHUB_OUTPUT - # echo "cache-dir-npm=${HOME}/.npm" >> $GITHUB_OUTPUT + - name: Set job vars + id: vars + run: | + echo "cache-key-npm=npm-vercel-${VERCEL_VERSION}" >> $GITHUB_OUTPUT + echo "cache-dir-npm=${HOME}/.npm" >> $GITHUB_OUTPUT - # - name: Set npm cache - # uses: actions/cache@v3 - # with: - # path: ${{ steps.vars.outputs.cache-dir-npm }} - # key: ${{ steps.vars.outputs.cache-key-npm }} + - name: Set npm cache + uses: actions/cache@v3 + with: + path: ${{ steps.vars.outputs.cache-dir-npm }} + key: ${{ steps.vars.outputs.cache-key-npm }} + + - name: Install Vercel CLI + run: npm install --global vercel@${VERCEL_VERSION} - # - name: Install Vercel CLI - # run: npm install --global vercel@${VERCEL_VERSION} + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} - # - name: Pull Vercel Environment Information - # run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Project Artifacts + run: vercel build --token=${{ secrets.VERCEL_TOKEN }} - # - name: Build Project Artifacts - # run: vercel build --token=${{ secrets.VERCEL_TOKEN }} + - name: Deploy Project Artifacts to Vercel + id: verceldeploy + run: | + export PREVIEW_URL=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} | tee out.log + export PREVIEW_URL=$(grep ^Preview out.log | awk '{print$2}') + echo "Discovered Preview URL: ${PREVIEW_URL}" + echo "url=$PREVIEW_URL" >> $GITHUB_OUTPUT - # - name: Deploy Project Artifacts to Vercel - # id: verceldeploy - # run: | - # export PREVIEW_URL=$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} | tee out.log - # export PREVIEW_URL=$(grep ^Preview out.log | awk '{print$2}') - # echo "Discovered Preview URL: ${PREVIEW_URL}" - # echo "url=$PREVIEW_URL" >> $GITHUB_OUTPUT + # - name: Update PR with test results + # uses: edumserrano/find-create-or-update-comment@v1 + # with: + # issue-number: ${{ github.event.pull_request.number }} + # body-includes: '' + # comment-author: 'github-actions[bot]' + # body: | # can be a single value or you can compose text with multi-line values + # + # Preview Documentation published at URL: ${{ steps.verceldeploy.outputs.url }} + # edit-mode: replace - # # - name: Update PR with test results - # # uses: edumserrano/find-create-or-update-comment@v1 - # # with: - # # issue-number: ${{ github.event.pull_request.number }} - # # body-includes: '' - # # comment-author: 'github-actions[bot]' - # # body: | # can be a single value or you can compose text with multi-line values - # # - # # Preview Documentation published at URL: ${{ steps.verceldeploy.outputs.url }} - # # edit-mode: replace + # - name: Find comment + # uses: peter-evans/find-comment@v2 + # id: fbc + # with: + # issue-number: ${{ github.event.pull_request.number }} + # comment-author: 'github-actions[bot]' + # body-includes: Docs published! - # # - name: Find comment - # # uses: peter-evans/find-comment@v2 - # # id: fbc - # # with: - # # issue-number: ${{ github.event.pull_request.number }} - # # comment-author: 'github-actions[bot]' - # # body-includes: Docs published! + - name: Create comment + # if: steps.fbc.outputs.comment-id == '' + uses: peter-evans/create-or-update-comment@v3 + with: + issue-number: ${{ github.event.pull_request.number }} + body: | + Docs published! + - Preview URL: ${{ steps.verceldeploy.outputs.url-dev }} + reactions: rocket - # - name: Create comment - # # if: steps.fbc.outputs.comment-id == '' + # - name: Update comment + # if: steps.fbc.outputs.comment-id != '' # uses: peter-evans/create-or-update-comment@v3 # with: - # issue-number: ${{ github.event.pull_request.number }} + # comment-id: ${{ steps.fbc.outputs.comment-id }} # body: | # Docs published! - # - Preview URL: ${{ steps.verceldeploy.outputs.url-dev }} - # reactions: rocket - - # # - name: Update comment - # # if: steps.fbc.outputs.comment-id != '' - # # uses: peter-evans/create-or-update-comment@v3 - # # with: - # # comment-id: ${{ steps.fbc.outputs.comment-id }} - # # body: | - # # Docs published! - # # - Preview URL: ${{ steps.deploy.outputs.url-dev }} - # # reactions: hooray + # - Preview URL: ${{ steps.deploy.outputs.url-dev }} + # reactions: hooray