Giter VIP home page Giter VIP logo

serverless-action's Introduction

Github Action to Deploy a Cloudflare Worker with the Serverless Framework

If you are new to GitHub actions please see the official guide here.

To use this action you must provide a Worker script (i.e. worker-script.js) in your repo attached to this action as well as the appropriate environmental variables.

File Structure

Your repo must include the CF Worker script to be deployed and an optional serverless.yml file. If you do not include a serverless.yml file then the action will assume some smart defaults to deploy the worker based on the ENV variables you pass. Any included serverless.yml must exist in the root of your repo along with your worker script.

Environmental Variables

This action will expect the following environmental variables to be passed:

CLOUDFLARE_AUTH_EMAIL #the email associated with the accout
CLOUDFLARE_ACCOUNT_ID #your account ID
CLOUDFLARE_ZONE_ID #your Cloudflare zone ID
CLOUDFLARE_AUTH_KEY #your global API key; use the secret variable type available within GitHub Actions for this variable
CLOUDFLARE_SCRIPT_NAME #the name of your worker-script.js file with .js ommited. NOTE: Worker names can contain lowercase letters, numbers, underscores, and dashes. They cannot start with dashes or contain uppercase letters.

Using a Custom Serverless.yml

The Serverless framework expects a serverless.yml file which allows us to use our existing Serverless integration to deploy Workers for this GitHub action. By default we provide one to deploy your worker. If you'd like to bring your own, please see here for getting started.

You may pass in other environmental variables to your custom serverless.yml if needed just make sure to refer to them by using ${env:YOUR_VARIABLE} syntax.

In a multiscript (Enterprise) environment the name will be seen in the UI where all your scripts are listed. In a single script environment the name will not be shown in the UI (as there is only one script).

main.workflow

The main.workflow output could look something like:

workflow "Depkoy Worker {
  on = "push"
  resolves = ["cloudflare/serverless-action@master"]
}

action "Deploy Worker" {
  uses = "cloudflare/serverless-action@master"
  env = {
    CLOUDFLARE_ACCOUNT_ID = "ACCOUNT_ID"
    CLOUDFLARE_ZONE_ID = "ZONE_ID"
    CLOUDFLARE_AUTH_EMAIL = "[email protected]"
    CLOUDFLARE_SCRIPT_NAME = "worker-script"
  }
  secrets = ["CLOUDFLARE_AUTH_KEY"]
}

License

The Dockerfile and associated scripts and documentation in this project are released under the MIT License.

serverless-action's People

Contributors

tombrightbill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

serverless-action's Issues

How do I get a zone id without a registered site in Cloudflare?

I'm attempting to use this action to deploy a Cloudflare worker. I don't have a registered site in Cloudflare and I don't believe that you need one to deploy a worker. However, when I attempt to use this action without passing a zone id, it fails. Do you know where I can find my zone id without a registered site?

vulnerability alert when running the action

I received following alert during Github Action build:

warning serverless > @serverless/components > chokidar > [email protected]: Please update to v 2.2.x
warning serverless > @serverless/components > @serverless/platform-client > [email protected]: Critical security vulnerability fixed in v0.21.1. For more information, see axios/axios#3410
warning serverless > @serverless/components > @serverless/platform-client-china > @serverless/utils-china > @tencent-sdk/capi > [email protected]: request has been deprecated, see request/request#3142
warning serverless > @serverless/components > @serverless/platform-client-china > @serverless/utils-china > @tencent-sdk/capi > [email protected]: request-promise-native has been deprecated because it extends the now deprecated request package, see request/request#3142
warning serverless > @serverless/components > @serverless/platform-client-china > @serverless/utils-china > @tencent-sdk/capi > request > [email protected]: this library is no longer supported
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "serverless > @serverless/components > [email protected]" has unmet peer dependency "inquirer@^5.0.0 || ^6.0.0 || ^7.0.0".

Hello blogs and Git, GitHub

I have been always close to people because I had to move. What I've seen this week is the instability of Instagram, which is a tool for my 2 blogs. People don't wanna invest in something pretty. Git and GitHub will be the new house on my Apple as a repository? While newbies are with the hype of Figma.I've had the luck of trying almost all platforms. I think we need we need to go a little low on the prices, of course never like Siteground 0.99 USA Monthy, which was a terrific disaster, the COVID is not gone, and we have "now SG telling us/forcing us" for a payment of 1 year( ( have the contract of 3 months), complained to the BBB. Sometimes I feel like coding, others to helping my ex-colleagues from Lan Chile. I have to finish the Blog, BBL! :)

Follow DRY principles

CLOUDFLARE_ACCOUNT_ID #your account ID
CLOUDFLARE_ZONE_ID #your Cloudflare zone ID

Are already in wrangler.toml .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.