本文へスキップ

Wrangler Action

メンテナンス中
cloudflare/wrangler-action

Wrangler で Cloudflare Workers と Pages をデプロイする GitHub Action。GitHub の CI/CD と統合され、スケジュールデプロイに対応し、本番環境とプレビュー環境の両方を扱えます。

GitHub で見る
スター
1886
フォーク
211
ウォッチ
1886
未解決の Issue
52

この紹介文は現在英語版のみです。

A GitHub Action for deploying Cloudflare Workers and Pages applications using Wrangler, enabling seamless integration with your GitHub CI/CD workflows.

Key Features

  • Simplified Deployment: Deploy Workers applications with minimal configuration
  • Pages Support: Deploy both production and preview environments for Cloudflare Pages
  • Flexible Triggers: Deploy on push, schedule, or manual triggers
  • Version Management: Support for creating and managing Worker versions
  • Secret Management: Securely handle environment-specific secrets
  • Multiple Package Managers: Support for npm, yarn, pnpm, and Bun
  • Command Output Access: Capture deployment outputs for use in subsequent workflow steps
  • Automatic Detection: Smart detection of project structure and configuration

Basic Usage

Add this workflow to your project to deploy on every push to the main branch:

name: Deploy

on:
  push:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    name: Deploy
    steps:
      - uses: actions/checkout@v4
      - name: Deploy
        uses: cloudflare/wrangler-action@v3
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}

Advanced Deployment Options

The action supports various deployment scenarios:

  • Pages Deployments: Deploy Pages projects with automatic preview/production detection
  • Scheduled Deployments: Run deployments on a recurring basis using cron syntax
  • Manual Triggers: Deploy on-demand with configurable workflow inputs
  • Worker Versions: Create Worker versions without immediate deployment
  • Environment-specific Configuration: Target specific environments with customized settings

Integration with GitHub Features

Wrangler Action integrates well with GitHub’s ecosystem:

  • GitHub Deployments: Track deployments in the GitHub UI
  • Workflow Dispatch: Trigger deployments manually with parameters
  • Output Variables: Access deployment URLs and command outputs in subsequent steps
  • Secrets Management: Securely store and use sensitive credentials

When to Use

  • When automating deployments of Cloudflare Workers applications
  • When building CI/CD pipelines for Cloudflare Pages projects
  • When you need environment-specific deployments (dev, staging, production)
  • When you want scheduled or manual deployment options
  • When you need to capture and utilize deployment results within your workflow

Frequently Asked Questions

How do I set up authentication?

Create a Cloudflare API token with the appropriate permissions, then add it to your GitHub repository secrets.

Can I deploy to different environments?

Yes, use the command parameter with the --env flag to specify the target environment.

How do I handle environment-specific secrets?

Use the secrets parameter along with the environment parameter to provide environment-specific values.

Does this work with package managers other than npm?

Yes, the action automatically detects your package manager based on lock files, or you can explicitly specify it using the packageManager parameter.

共通のカテゴリとタグで順位付けした、似たオープンソースプロジェクトです。

すべての DevOps プロジェクト →