From d048e4650f9f01db641b58eeec46fbcfecd707e9 Mon Sep 17 00:00:00 2001 From: Antoine BERNIER Date: Sat, 17 Aug 2024 12:11:05 +0200 Subject: [PATCH] chore: gha vercel production deployment --- .github/workflows/{docker.yml => release.yml} | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) rename .github/workflows/{docker.yml => release.yml} (51%) diff --git a/.github/workflows/docker.yml b/.github/workflows/release.yml similarity index 51% rename from .github/workflows/docker.yml rename to .github/workflows/release.yml index b8d1773c..d1e6d58b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/release.yml @@ -1,5 +1,4 @@ -# https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages -name: Create and publish a Docker image +name: Deploy Production environment on Vercel and Publish Docker image on: push: branches: ['main'] @@ -9,6 +8,38 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: + vercel-job: + runs-on: ubuntu-latest + # Update the "Production" environment with the Vercel deployed URL + environment: + name: Production + 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=production --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= \ + --build-env HOME_REDIRECT= \ + --build-env MDX_BASEURL="https://github.com/${{ github.repository }}/raw/${{ github.head_ref }}/docs" \ + --build-env EDIT_BASEURL="https://github.com/${{ github.repository }}/edit/${{ github.head_ref }}/docs" \ + --build-env NEXT_PUBLIC_URL="$VERCEL_PROJECT_PRODUCTION_URL" \ + --build-env ICON= \ + --build-env LOGO=gutenberg.jpg \ + > deployment-url.txt + + echo "deployment_url=$(cat deployment-url.txt)" >> $GITHUB_OUTPUT + env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} + + # https://docs.github.com/en/actions/publishing-packages/publishing-docker-images#publishing-images-to-github-packages build-and-push-image: runs-on: ubuntu-latest