Merge pull request #1635 from EpicenterHQ/opencode/playful-knight #165
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to Cloudflare Workers | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| name: Build & Deploy | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version-file: 'package.json' | |
| - name: Install dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Build all packages | |
| run: bun run build | |
| env: | |
| NODE_ENV: production | |
| - name: Deploy Whispering | |
| id: whispering | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| workingDirectory: apps/whispering | |
| packageManager: bun | |
| command: deploy | |
| - name: Deploy Landing | |
| id: landing | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| workingDirectory: apps/landing | |
| packageManager: bun | |
| command: deploy | |
| - name: Deploy API | |
| id: api | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| workingDirectory: apps/api | |
| packageManager: bun | |
| command: deploy | |
| - name: Deployment summary | |
| if: always() | |
| run: | | |
| echo "## Deployment Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| App | URL |" >> $GITHUB_STEP_SUMMARY | |
| echo "|-----|-----|" >> $GITHUB_STEP_SUMMARY | |
| echo "| Whispering | ${{ steps.whispering.outputs.deployment-url }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| Landing | ${{ steps.landing.outputs.deployment-url }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "| API | ${{ steps.api.outputs.deployment-url }} |" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY | |
| - name: Send Discord notification | |
| if: always() | |
| env: | |
| DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }} | |
| run: | | |
| if [ -z "$DISCORD_WEBHOOK" ]; then exit 0; fi | |
| STATUS_COLOR=$([ "${{ job.status }}" = "success" ] && echo "3066993" || echo "15158332") | |
| PAYLOAD=$(cat <<EOF | |
| { | |
| "embeds": [{ | |
| "title": "Deployment ${{ job.status }}", | |
| "color": $STATUS_COLOR, | |
| "fields": [ | |
| { | |
| "name": "Whispering", | |
| "value": "${{ steps.whispering.outputs.deployment-url }}", | |
| "inline": true | |
| }, | |
| { | |
| "name": "Landing", | |
| "value": "${{ steps.landing.outputs.deployment-url }}", | |
| "inline": true | |
| }, | |
| { | |
| "name": "API", | |
| "value": "${{ steps.api.outputs.deployment-url }}", | |
| "inline": true | |
| } | |
| ], | |
| "footer": { | |
| "text": "Commit: ${{ github.sha }}" | |
| } | |
| }] | |
| } | |
| EOF | |
| ) | |
| curl -s -X POST -H "Content-Type: application/json" -d "$PAYLOAD" "$DISCORD_WEBHOOK" || true |