From ebb5056540a1796c2936ec9decb33f8be686cc70 Mon Sep 17 00:00:00 2001 From: Vitaly Turovsky Date: Wed, 23 Oct 2024 02:31:04 +0300 Subject: [PATCH] ci: refactor deployment workflow in preview.yml by removing unused checks and adding alias retrieval step --- .github/workflows/preview.yml | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml index fd4246206..ddb386b7d 100644 --- a/.github/workflows/preview.yml +++ b/.github/workflows/preview.yml @@ -8,13 +8,6 @@ on: types: [created] pull_request_target: jobs: - check-trigger: - runs-on: ubuntu-latest - steps: - - run: echo ${{ vars.AUTO_DEPLOY_PRS }} - - run: echo ${{ fromJson(vars.AUTO_DEPLOY_PRS) }} - - run: echo ${{ toJson(contains(fromJson(vars.AUTO_DEPLOY_PRS), github.event.pull_request.number)) }} - - run: echo ${{ toJson(contains(fromJson(vars.AUTO_DEPLOY_PRS), 120)) }} deploy: runs-on: ubuntu-latest if: >- @@ -32,6 +25,16 @@ jobs: permissions: pull-requests: write steps: + - name: Checkout Base To Temp + uses: actions/checkout@v2 + with: + path: temp-base-repo + - name: Get deployment alias + run: node temp-base-repo/scripts/githubActions.mjs getAlias + id: alias + env: + ALIASES: ${{ env.ALIASES }} + PULL_URL: ${{ github.event.issue.pull_request.url || github.event.pull_request.url }} - name: Checkout PR (comment) uses: actions/checkout@v2 if: github.event_name == 'issue_comment' @@ -68,6 +71,7 @@ jobs: run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }} id: deploy - uses: mshick/add-pr-comment@v2 + # if: github.event_name == 'issue_comment' with: allow-repeats: true message: | @@ -75,12 +79,6 @@ jobs: [Playground](${{ steps.deploy.outputs.stdout }}/playground/) [Storybook](${{ steps.deploy.outputs.stdout }}/storybook/) # - run: git checkout next scripts/githubActions.mjs - - name: Get deployment alias - run: node scripts/githubActions.mjs getAlias - id: alias - env: - ALIASES: ${{ env.ALIASES }} - PULL_URL: ${{ github.event.issue.pull_request.url || github.event.pull_request.url }} - name: Set deployment alias if: ${{ steps.alias.outputs.alias != '' && steps.alias.outputs.alias != 'mcraft.fun' && steps.alias.outputs.alias != 's.mcraft.fun' }} run: vercel alias set ${{ steps.deploy.outputs.stdout }} ${{ steps.alias.outputs.alias }} --token=${{ secrets.VERCEL_TOKEN }} --scope=zaro