From 3c57b9fc63b29c79111feef3364e2b997618b13a Mon Sep 17 00:00:00 2001 From: Antoine BERNIER Date: Sat, 17 Aug 2024 10:43:13 +0200 Subject: [PATCH] vercel preview workflow --- .github/workflows/preview.yml | 53 +++++++++++++++++++++++++++++++++++ docs/introduction.mdx | 14 +++++++++ 2 files changed, 67 insertions(+) create mode 100644 .github/workflows/preview.yml create mode 100644 docs/introduction.mdx diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml new file mode 100644 index 00000000..fa28ede6 --- /dev/null +++ b/.github/workflows/preview.yml @@ -0,0 +1,53 @@ +on: + pull_request: + branches: ['main'] + +jobs: + foo: + runs-on: ubuntu-latest + + environment: + name: Preview + url: ${{ steps.vercel-deploy.outputs.deployment_url }} + + steps: + - uses: actions/setup-node@v4 + - uses: actions/checkout@v4 + - id: vercel-deploy + 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 "deployment_url=$(cat deployment-url.txt)" >> $GITHUB_OUTPUT + env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + # - run: | + # curl --fail -X POST \ + # -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + # -H "Accept: application/vnd.github.v3+json" \ + # -d '{ + # "ref": "${{ github.ref }}", + # "environment": "preview", + # "transient_environment": true, + # "production_environment": false, + # "description": "Preview deployment", + # "auto_merge": false, + # "required_contexts": [], + # "payload": { + # "url": "${{ env.deployment_url }}" + # } + # }' \ + # https://api.github.com/repos/${{ github.repository }}/deployments diff --git a/docs/introduction.mdx b/docs/introduction.mdx new file mode 100644 index 00000000..5f8661fe --- /dev/null +++ b/docs/introduction.mdx @@ -0,0 +1,14 @@ +--- +title: foo +description: bar +--- + +This is pmndrs/docs documentation 🙃. + +# headin 1 + +asdfasdf + +## sadf + +aooijoafdsi