From bd2ec17006f88fada8485d74352954d220bf4d45 Mon Sep 17 00:00:00 2001 From: Ride Control Date: Thu, 23 Jul 2026 00:20:37 -0700 Subject: [PATCH] Deploy frontend after main CI --- .github/workflows/ci.yml | 43 +++++++++++++++++++++ .github/workflows/deploy-worker.yml | 58 ----------------------------- 2 files changed, 43 insertions(+), 58 deletions(-) delete mode 100644 .github/workflows/deploy-worker.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ff6665..3db4e44 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ on: permissions: contents: read + pull-requests: read jobs: ci: @@ -26,3 +27,45 @@ jobs: run: bun install --frozen-lockfile - name: Run checks, tests, and build run: bun run ci + + deploy: + name: Deploy Worker + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + needs: ci + runs-on: ubuntu-latest + concurrency: + group: production-worker + cancel-in-progress: false + environment: + name: production + url: https://ridecontrol.xyz + steps: + - name: Check out verified revision + uses: actions/checkout@v7 + with: + ref: ${{ github.sha }} + - name: Set up Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + - name: Install dependencies + run: bun install --frozen-lockfile + - name: Resolve build metadata + env: + BUILD_SHA: ${{ github.sha }} + GH_TOKEN: ${{ github.token }} + run: | + echo "VITE_BUILD_TIMESTAMP=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_ENV" + build_pr_url="$(gh api "repos/${GITHUB_REPOSITORY}/commits/${BUILD_SHA}/pulls" --jq '.[0].html_url // empty')" + if [ -z "$build_pr_url" ]; then + build_pr_url="https://github.com/${GITHUB_REPOSITORY}/pulls?q=is%3Apr+is%3Aclosed" + fi + echo "VITE_BUILD_PR_URL=${build_pr_url}" >> "$GITHUB_ENV" + - name: Build Worker + run: bun run build + - name: Deploy Worker + uses: cloudflare/wrangler-action@v3 + with: + accountId: c1e6e1378d9461aa07039950b1bf8b89 + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + command: deploy diff --git a/.github/workflows/deploy-worker.yml b/.github/workflows/deploy-worker.yml deleted file mode 100644 index e1d2f0e..0000000 --- a/.github/workflows/deploy-worker.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Deploy Worker - -on: - workflow_run: - workflows: - - CI - types: - - completed - branches: - - main - workflow_dispatch: - -permissions: - contents: read - pull-requests: read - -concurrency: - group: production-worker - cancel-in-progress: false - -jobs: - deploy: - name: Deploy Worker - if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' - runs-on: ubuntu-latest - environment: - name: production - url: https://ridecontrol.xyz - steps: - - name: Check out verified revision - uses: actions/checkout@v7 - with: - ref: ${{ github.event.workflow_run.head_sha || github.sha }} - - name: Set up Bun - uses: oven-sh/setup-bun@v2 - with: - bun-version: latest - - name: Install dependencies - run: bun install --frozen-lockfile - - name: Resolve build metadata - env: - BUILD_SHA: ${{ github.event.workflow_run.head_sha || github.sha }} - GH_TOKEN: ${{ github.token }} - run: | - echo "VITE_BUILD_TIMESTAMP=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_ENV" - build_pr_url="$(gh api "repos/${GITHUB_REPOSITORY}/commits/${BUILD_SHA}/pulls" --jq '.[0].html_url // empty')" - if [ -z "$build_pr_url" ]; then - build_pr_url="https://github.com/${GITHUB_REPOSITORY}/pulls?q=is%3Apr+is%3Aclosed" - fi - echo "VITE_BUILD_PR_URL=${build_pr_url}" >> "$GITHUB_ENV" - - name: Build Worker - run: bun run build - - name: Deploy Worker - uses: cloudflare/wrangler-action@v3 - with: - accountId: c1e6e1378d9461aa07039950b1bf8b89 - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - command: deploy