Skip to content

Deploy to Cloudflare Workers with Wrangler and get publish URL

Actions
Deploy your Cloudflare Workers and Pages projects from GitHub using Wrangler
2.0.0
Latest
Star (3)

Wrangler action with publish URL

This action extends core Wrangler GitHub Action by adding publish URL to GITHUB_OUTPUT

Usage

  • add id to your Wrangler deploy task
  • grab publish URL via steps.<YOUR_GH_TASK_ID>.outputs.url

Example action with multiple deploys and comment

name: CloudFlare

on:
  push:
    branches: [master]
  pull_request:
    branches: [master]

jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: write

    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3
        with:
          node-version: 16.x
          cache: 'yarn'
      - run: yarn install --frozen-lockfile

      - run: yarn build-preview && yarn build-storybook
      - name: Deploy App to Cloudflare Workers
        id: wrangler
        uses: buberdds/[email protected]
        with:
          apiToken: ${{ secrets.CLOUDFLARE_PAGES_API_TOKEN }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          command: pages publish "./build" --project-name=<YOUR_CLOUDFLARE_PROJECT_NAME>

      - name: Deploy Storybook to Cloudflare Workers
        id: wrangler-storybook
        uses: buberdds/[email protected]
        with:
          apiToken: ${{ secrets.CLOUDFLARE_PAGES_API_TOKEN }}
          accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
          command: pages publish "./storybook-static" --project-name=<YOUR_CLOUDFLARE_PROJECT_NAME>

      - name: Add Comment to PR
        uses: peter-evans/create-or-update-comment@v1
        with:
          issue-number: ${{ github.event.pull_request.number }}
          body: |
            App has been deployed to: ${{ steps.wrangler.outputs.url }}
            Storybook has been deployed to: ${{ steps.wrangler-storybook.outputs.url }}

Deploy to Cloudflare Workers with Wrangler and get publish URL is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Deploy your Cloudflare Workers and Pages projects from GitHub using Wrangler
2.0.0
Latest

Deploy to Cloudflare Workers with Wrangler and get publish URL is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.