GithubHelp home page GithubHelp logo

isabella232 / semaphore-demo-cloudflare-workers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from semaphoreci-demos/semaphore-demo-cloudflare-workers

0.0 0.0 0.0 767 KB

A demo CI/CD pipeline for Cloudflare workers.

License: MIT License

JavaScript 100.00%

semaphore-demo-cloudflare-workers's Introduction

Semaphore Demo CI/CD Pipeline for Cloudflare Workers

Example project on how to build to deploy to Cloudflare Workers using the Serverless framework.

Add Project to Semaphore

In order to deploy, you must have a domain active in Cloudflare.

  1. Fork this repository and create a project on Semaphore.
  2. Go to your Cloudflare account domain. In Overview look for the Zone ID and the Account ID.
  3. Go to Get your API Key. Copy the authorized email.
  4. Go to API Tokens. Click on View next to Global API Key. Copy the displayed key.
  5. Add a secret on Semaphore as detailed in the next section.
  6. Edit serverless.yml. Edit the url key with the route that you want to trigger the function. The URL must contain your domain name.
    ...
        events:
            - http:
                url: example.com/hello
                method: GET
    ...
  7. Push to GitHub.

This is how the complete workflow looks:

Workflow

Add Secret to Semaphore

Create a secret on Semaphore with your Cloudflare details:

$ sem create secret cloudflare \
    -e CLOUDFLARE_AUTH_EMAIL=YOUR_EMAIL \
    -e CLOUDFLARE_AUTH_KEY=YOUR_API_KEY \
    -e CLOUDFLARE_ACCOUNT_ID=YOUR_ACCOUNT_ID \
    -e CLOUDFLARE_ZONE_ID=YOUR_ZONE_ID

Local build

You can also run the tests on your dev machine, for this, install Node.js and nvm.

$ nvm use
$ npm install
$ npm run lint
$ npm test

License

Copyright (c) 2019 Rendered Text

Distributed under the MIT License. See the file LICENSE.md.

semaphore-demo-cloudflare-workers's People

Contributors

markoa avatar tomfern avatar

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.