From ef45cd985858724e3adb7c1491da1fac3e7ad6c6 Mon Sep 17 00:00:00 2001 From: azzahamdani Date: Tue, 10 Mar 2026 14:50:36 +0100 Subject: [PATCH 1/3] update the workflow inline because the repository is public and cannot access central repository --- .github/workflows/deploy.yml | 119 +++++++++++++++++++++++++++-------- 1 file changed, 94 insertions(+), 25 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 056159b..2d3d613 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,34 +11,103 @@ on: jobs: deploy-production: if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' - uses: lifinance/github-actions/.github/workflows/cloudflare-worker-deploy.yaml@main - with: - environment: production - build-command: "bun run build" - node-version: "20" - secrets: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + runs-on: ubuntu-latest + name: Deploy to Production + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Build application + run: bun run build + + - name: Deploy to Cloudflare Workers + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + wranglerVersion: "4.71.0" + command: deploy --env production deploy-preview: if: github.event_name == 'pull_request' && github.event.action != 'closed' - uses: lifinance/github-actions/.github/workflows/cloudflare-worker-deploy.yaml@main - with: - environment: preview - build-command: "bun run build" - node-version: "20" - preview-name: lintent-pr-${{ github.event.pull_request.number }} - secrets: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + runs-on: ubuntu-latest + name: Deploy Preview + permissions: + contents: read + pull-requests: write + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: latest + + - name: Install dependencies + run: bun install --frozen-lockfile + + - name: Build application + run: bun run build + + - name: Deploy to Cloudflare Workers + id: deploy + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + wranglerVersion: "4.71.0" + command: deploy --name lintent-pr-${{ github.event.pull_request.number }} + + - name: Post deployment comment + uses: actions/github-script@v7 + with: + script: | + const maxAttempts = 3; + const delayMs = 10000; + for (let attempt = 1; attempt <= maxAttempts; attempt++) { + try { + await github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `🚀 **Preview deployed!**\n\n**Worker:** \`lintent-pr-${{ github.event.pull_request.number }}\`\n**URL:** ${{ steps.deploy.outputs.deployment-url }}` + }); + return; + } catch (error) { + core.warning(`Attempt ${attempt}/${maxAttempts} failed: ${error.message}`); + if (attempt === maxAttempts) throw error; + await new Promise(r => setTimeout(r, delayMs)); + } + } cleanup-preview: if: github.event_name == 'pull_request' && github.event.action == 'closed' - uses: lifinance/github-actions/.github/workflows/cloudflare-worker-deploy.yaml@main - with: - delete-preview: true - preview-name: lintent-pr-${{ github.event.pull_request.number }} - node-version: "20" - secrets: - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + runs-on: ubuntu-latest + name: Cleanup Preview Worker + steps: + - name: Delete preview worker + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + wranglerVersion: "4.71.0" + command: delete --name lintent-pr-${{ github.event.pull_request.number }} --force From af5fa2dec46c3d371e0194aced414ae61fff65f4 Mon Sep 17 00:00:00 2001 From: azzahamdani Date: Tue, 10 Mar 2026 15:41:23 +0100 Subject: [PATCH 2/3] add the env vriable to the pipeline --- .github/workflows/deploy.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 2d3d613..dc069b8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -31,6 +31,10 @@ jobs: run: bun install --frozen-lockfile - name: Build application + env: + PRIVATE_POLYMER_MAINNET_ZONE_API_KEY: ${{ secrets.PRIVATE_POLYMER_MAINNET_ZONE_API_KEY }} + PRIVATE_POLYMER_TESTNET_ZONE_API_KEY: ${{ secrets.PRIVATE_POLYMER_TESTNET_ZONE_API_KEY }} + PUBLIC_WALLET_CONNECT_PROJECT_ID: ${{ secrets.PUBLIC_WALLET_CONNECT_PROJECT_ID }} run: bun run build - name: Deploy to Cloudflare Workers @@ -66,6 +70,10 @@ jobs: run: bun install --frozen-lockfile - name: Build application + env: + PRIVATE_POLYMER_MAINNET_ZONE_API_KEY: ${{ secrets.PRIVATE_POLYMER_MAINNET_ZONE_API_KEY }} + PRIVATE_POLYMER_TESTNET_ZONE_API_KEY: ${{ secrets.PRIVATE_POLYMER_TESTNET_ZONE_API_KEY }} + PUBLIC_WALLET_CONNECT_PROJECT_ID: ${{ secrets.PUBLIC_WALLET_CONNECT_PROJECT_ID }} run: bun run build - name: Deploy to Cloudflare Workers From 30679d3fa74999b5e7a179135972f0f5fa8e145f Mon Sep 17 00:00:00 2001 From: azzahamdani Date: Tue, 10 Mar 2026 15:44:28 +0100 Subject: [PATCH 3/3] add the env variables to the Deploy to Cloudflare Workers steps --- .github/workflows/deploy.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index dc069b8..5c9a897 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -39,6 +39,10 @@ jobs: - name: Deploy to Cloudflare Workers uses: cloudflare/wrangler-action@v3 + env: + PRIVATE_POLYMER_MAINNET_ZONE_API_KEY: ${{ secrets.PRIVATE_POLYMER_MAINNET_ZONE_API_KEY }} + PRIVATE_POLYMER_TESTNET_ZONE_API_KEY: ${{ secrets.PRIVATE_POLYMER_TESTNET_ZONE_API_KEY }} + PUBLIC_WALLET_CONNECT_PROJECT_ID: ${{ secrets.PUBLIC_WALLET_CONNECT_PROJECT_ID }} with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} @@ -79,6 +83,10 @@ jobs: - name: Deploy to Cloudflare Workers id: deploy uses: cloudflare/wrangler-action@v3 + env: + PRIVATE_POLYMER_MAINNET_ZONE_API_KEY: ${{ secrets.PRIVATE_POLYMER_MAINNET_ZONE_API_KEY }} + PRIVATE_POLYMER_TESTNET_ZONE_API_KEY: ${{ secrets.PRIVATE_POLYMER_TESTNET_ZONE_API_KEY }} + PUBLIC_WALLET_CONNECT_PROJECT_ID: ${{ secrets.PUBLIC_WALLET_CONNECT_PROJECT_ID }} with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}