-
Notifications
You must be signed in to change notification settings - Fork 94
39 lines (36 loc) · 1.65 KB
/
preview.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
on:
pull_request:
branches: ['main']
jobs:
foo:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
- uses: actions/checkout@v4
- run: |
npx -y vercel deploy --target=preview --token=${{ secrets.VERCEL_TOKEN }} \
--build-env MDX=docs \
--build-env NEXT_PUBLIC_LIBNAME="Poimandres" \
--build-env NEXT_PUBLIC_LIBNAME_SHORT="pmndrs" \
--build-env BASE_PATH= \
--build-env DIST_DIR= \
--build-env OUTPUT=export \
--build-env HOME_REDIRECT=/introduction \
--build-env MDX_BASEURL="https://github.com/${{ github.repository }}/raw/${{ github.ref_name }}/docs" \
--build-env EDIT_BASEURL="https://github.com/${{ github.repository }}/edit/${{ github.ref_name }}/docs" \
--build-env NEXT_PUBLIC_URL="$VERCEL_PROJECT_PRODUCTION_URL" \
--build-env ICON="🖨️" \
--build-env LOGO= \
> deployment-url.txt
echo "coucou"
echo "$(cat deployment-url.txt)" >> $GITHUB_OUTPUT
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
- run: |
DEPLOYMENT_URL=$(cat deployment-url.txt)
curl -X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '{"environment":"preview", "transient_environment": true, "production_environment": false, "description":"Preview deployment", "url": "'$DEPLOYMENT_URL'"}' \
https://api.github.com/repos/${{ github.repository }}/deployments