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 }})"