diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 16292ef7..2146499d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,6 +6,7 @@ on: mdx: required: true type: string + description: 'path to the MDX docs folder. Should be relative to the root of the repository, not starting with `./`, eg: `docs`' libname: required: true type: string @@ -67,7 +68,7 @@ jobs: set -ex docker run --rm --init \ - -v "$MDX":/app/docs \ + -v "./$MDX":/app/docs \ -e BASE_PATH \ -e DIST_DIR="$MDX/out$BASE_PATH" \ -e MDX \ @@ -90,7 +91,7 @@ jobs: -e THEME_IMPORTANT \ -e THEME_WARNING \ -e THEME_CAUTION \ - ghcr.io/pmndrs/docs:1 npm run build + ghcr.io/pmndrs/docs:2 npm run build env: BASE_PATH: ${{ steps.set-base-path.outputs.BASE_PATH }} MDX: ${{ inputs.mdx }} diff --git a/.github/workflows/preview.yml b/.github/workflows/preview.yml deleted file mode 100644 index 9ccea3f2..00000000 --- a/.github/workflows/preview.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Build and Deploy Preview environment on Vercel -on: - pull_request: - branches: ['main'] - -jobs: - deploy-job: - runs-on: ubuntu-latest - - # Update the "Preview" environment with the Vercel deployed URL - 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= \ - --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 \ - --build-env GITHUB="https://github.com/${{ github.repository }}" \ - --build-env DISCORD="${{ secrets.DISCORD }}" \ - --build-env THEME_PRIMARY="#323e48" \ - --build-env THEME_SCHEME="tonalSpot" \ - --build-env THEME_CONTRAST="0" \ - --build-env THEME_NOTE="#1f6feb" \ - --build-env THEME_TIP="#238636" \ - --build-env THEME_IMPORTANT="#8957e5" \ - --build-env THEME_WARNING="#d29922" \ - --build-env THEME_CAUTION="#da3633" \ - > 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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4f1bd2c0..362783a2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,11 @@ -name: Deploy Production environment on Vercel and Publish Docker image +name: Deploy on Vercel and Publish Docker image on: push: - branches: ['main'] + branches: + - 'main' + - 'beta' + - 'alpha' + - 'canary-*' env: REGISTRY: ghcr.io @@ -31,9 +35,9 @@ jobs: needs: semantic-release-job if: needs.semantic-release-job.outputs.new_release_version != '' - # Update the "Production" environment with the Vercel deployed URL + # Update the Production/Preview environment with the Vercel deployed URL environment: - name: Production + name: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && 'Production' || 'Preview' }} url: ${{ steps.vercel-deploy.outputs.deployment_url }} steps: @@ -41,7 +45,8 @@ jobs: - uses: actions/checkout@v4 - id: vercel-deploy run: | - npx -y vercel deploy --target=production --token=${{ secrets.VERCEL_TOKEN }} \ + npx -y vercel deploy --token=${{ secrets.VERCEL_TOKEN }} \ + --target=${{ github.event_name == 'push' && 'production' || 'preview' }} \ --build-env MDX=docs \ --build-env NEXT_PUBLIC_LIBNAME="Poimandres" \ --build-env NEXT_PUBLIC_LIBNAME_SHORT="pmndrs" \ diff --git a/docs/getting-started/introduction.mdx b/docs/getting-started/introduction.mdx index 99ed05b9..32261307 100644 --- a/docs/getting-started/introduction.mdx +++ b/docs/getting-started/introduction.mdx @@ -180,7 +180,7 @@ $ ( export _PORT=60141 - export MDX=./docs + export MDX=docs export NEXT_PUBLIC_LIBNAME="React Three Fiber" export NEXT_PUBLIC_LIBNAME_SHORT="r3f" export BASE_PATH= @@ -205,7 +205,7 @@ $ ( rm -rf "$MDX/out" docker run --rm --init -it \ - -v "$MDX":/app/docs \ + -v "./$MDX":/app/docs \ -e MDX \ -e NEXT_PUBLIC_LIBNAME \ -e BASE_PATH \ diff --git a/release.config.mjs b/release.config.mjs index 0d3d0f16..6dbbf116 100644 --- a/release.config.mjs +++ b/release.config.mjs @@ -1,5 +1,15 @@ /** @type {import('semantic-release').GlobalConfig} */ const config = { + branches: [ + '+([0-9])?(.{+([0-9]),x}).x', + 'master', + 'main', + 'next', + 'next-major', + { name: 'beta', prerelease: true }, + { name: 'alpha', prerelease: true }, + { name: 'canary-*', prerelease: true }, + ], plugins: [ '@semantic-release/commit-analyzer', '@semantic-release/release-notes-generator',