Skip to content

🧙‍♀️ zero-config cloudflare workers application deployment using wrangler and github actions

License

Notifications You must be signed in to change notification settings

buberdds/wrangler-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 
 

Repository files navigation

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 }}

About

🧙‍♀️ zero-config cloudflare workers application deployment using wrangler and github actions

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 59.1%
  • JavaScript 37.3%
  • Dockerfile 2.1%
  • HTML 1.5%