From c95a216e8a95d70d6538106c392637c13d57651b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Baranx?= Date: Wed, 28 Feb 2024 17:02:40 +0700 Subject: [PATCH] [chore] add Vercel preview for PRs --- .github/workflows/preview.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/workflows/preview.yml diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 0000000..0877ef5 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,21 @@ +name: Vercel +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} +on: + pull_request_target: + types: [labeled] +jobs: + preview: + runs-on: ubuntu-latest + environment: + name: preview + url: ${{ steps.deploy.outputs.url }} + if: contains(github.event.pull_request.labels.*.name, 'safe to preview') + steps: + - uses: actions/checkout@v3 + - run: npm install --global vercel@latest + - run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} + - run: vercel build --token=${{ secrets.VERCEL_TOKEN }} + - id: deploy + run: echo "::set-output name=url::$(vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }})"