From ca4432bcdecff0fd1f4420e5428c529b8b00ed9e Mon Sep 17 00:00:00 2001 From: Wanjohi <71614375+wanjohiryan@users.noreply.github.com> Date: Wed, 26 Mar 2025 03:31:09 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9C=20fix(ci):=20Fix=20issue=20where?= =?UTF-8?q?=20main=20does=20not=20deploy=20to=20prod=20(#216)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description Fix an issue where the `apps/www` CI does not push to main ## Related Issues ## Type of Change - [x] Bug fix (non-breaking change) - [ ] New feature (non-breaking change) - [ ] Breaking change (fix or feature that changes existing functionality) - [ ] Documentation update - [ ] Other (please describe): ## Checklist - [ ] I have updated relevant documentation - [ ] My code follows the project's coding style - [ ] My changes generate no new warnings/errors ## Notes for Reviewers ## Screenshots/Demo ## Additional Context --- .github/workflows/www.yml | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/.github/workflows/www.yml b/.github/workflows/www.yml index f5f4e3b7..867d7e96 100644 --- a/.github/workflows/www.yml +++ b/.github/workflows/www.yml @@ -1,4 +1,4 @@ -name: Build apps/www +name: Build www on: pull_request: @@ -12,8 +12,10 @@ on: - ".github/workflows/www.yml" jobs: - deploy: + deploy-www-pr: + name: Build www on PR runs-on: ubuntu-latest + if: ${{ github.event_name == 'pull_request' }} defaults: run: working-directory: "apps/www" @@ -35,6 +37,33 @@ jobs: wranglerVersion: "3.93.0" workingDirectory: "apps/www" command: pages deploy ./dist --project-name=${{ vars.CF_WWW_PAGES_PROJECT_NAME }} --commit-dirty=true + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + deploy-www-main: + name: Build www on main + runs-on: ubuntu-latest + if: ${{ github.ref == 'refs/heads/main' }} + defaults: + run: + working-directory: "apps/www" + steps: + - uses: actions/checkout@v4 + - uses: oven-sh/setup-bun@v1 + with: + bun-version: latest + - name: Install dependencies + run: bun install + - name: Build Project Artifacts + run: bun run build + - name: Deploy Project Artifacts to Cloudflare + uses: cloudflare/wrangler-action@v3 + with: + packageManager: bun + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + wranglerVersion: "3.93.0" + workingDirectory: "apps/www" + command: pages deploy ./dist --project-name=${{ vars.CF_WWW_PAGES_PROJECT_NAME }} --commit-dirty=true --branch=main env: CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} \ No newline at end of file