Skip to content

Update README.md - #57

Open
xiaunknown116-del wants to merge 1 commit into
cloudflare:mainfrom
xiaunknown116-del:patch-6
Open

xiaunknown116-del wants to merge 1 commit into
cloudflare:mainfrom
xiaunknown116-del:patch-6

Conversation

@xiaunknown116-del

Copy link
Copy Markdown

GitHub Actions CI/CD Pipeline Configuration

==============================================================================# GitHub Actions Automated CI/CD Deployment Pipeline# File: .github/workflows/deploy-edge.yml# Description: Automatically validates, builds, and deploys the TypeScript # Edge Worker infrastructure to Cloudflare using AWS IAM OIDC # federated tokens and the Cloudflare Wrangler integration.# ==============================================================================

name: Secure Edge Infrastructure Deployment
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:

id-token: write # Required for requesting the JWT via AWS OIDC
contents: read # Required for checking out the repository code
jobs:
validate-and-deploy:
name: Build & Deploy Edge Worker
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
  # 1. Checkout Codebase
  - name: Checkout Repository
    uses: actions/checkout@v4

  # 2. Setup Node.js Runtime Environment
  - name: Setup Node.js Environment
    uses: actions/setup-node@v4
    with:
      node-version: '20'

      cache: 'npm'

  # 3. Install Dependencies
  - name: Install Project Dependencies
    run: npm ci

  # 4. Authenticate to AWS via OIDC Identity Federation
  # Exchanges the GitHub OIDC token for temporary AWS credentials using the deployment role
  - name: Configure AWS Credentials from OIDC Provider
    uses: aws-actions/configure-aws-credentials@v4
    with:
      role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions-edge-deployer-role
      aws-region: us-east-1
      audience: ://amazonaws.com

  # 5. Retrieve Deployment Secrets from AWS Secrets Manager (Optional/Secure Check)
  # This step ensures security configurations or KV credentials can be synchronized dynamically
  - name: Retrieve Cloudflare Deployment Tokens
    uses: aws-actions/aws-secretsmanager-get-secrets@v2

    with:
      secret-ids: |
        CLOUDFLARE_API_TOKEN, arn:aws:secretsmanager:us-east-1:${{ secrets.AWS_ACCOUNT_ID }}:secret:CloudflareDeploymentTokens-xyz          parse-json-secrets: true

  # 6. Execute Automated Edge Build Compilation
  # Invokes esbuild via the completed build.js script to create dist/index.js
  - name: Run Production Bundle Compilation
    run: npm run build

  # 7. Deploy to Cloudflare Network Layer
  # Uses the Wrangler CLI to push the compiled assets and worker schema upstream
  - name: Deploy Worker to Cloudflare Global Edge
    uses: cloudflare/wrangler-action@v3
    with:
      apiToken: ${{ env.CLOUDFLARE_API_TOKEN }}
      command: deploy --compatibility-date="2026-09-08"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant