Git Product home page Git Product logo

deploy-6's Introduction

primer/deploy

This GitHub Action deploys to Now and aliases the successful deployment to a predictable URL according to the following conditions:

  1. We run now without any arguments to get the "root" deployment URL, which is generated by Now.
  2. If the branch is master, we treat the alias field in now.json as the production URL and:
    1. If there is a rules.json:
      • now alias <deployment> <name>.now.sh to create a fallback URL for path aliases
      • now alias <deployment> <production> -r rules.json to set up path aliases
    2. now alias <deployment> <production> to alias the production URL.
  3. now alias <deployment> <name>-<branch>.now.sh to alias the root deployment to a branch-specific URL.

The app name (<name>) and branch (<branch>) are both "slugified" to strip invalid characters so that they'll work as URLs. Leading non-word characters are removed, and any sequence of characters that isn't alphanumeric or - is replaced with a single -. In other words, @primer/css becomes primer-css, shawnbot/some_branch becomes shawnbot-some-branch, and so on.

Status checks

Two status checks will be listed for this action in your checks: deploy is the action's check, and deploy/alias is a commit status created by the action that reports the URL and links to it via "Details":

image

Note: Checks listed in the PR merge box (above) always point to the most recent commit, but you can access the list of checks for the last commit of every push by clicking on the status icon (usually a green check or red x) in your repo's "Commits" and "Branches" pages, or commit history on a PR page:

image

Usage

To use this action in your own workflow, add the following snippet to your .github/main.workflow file:

action "deploy" {
  uses = "primer/deploy@master"
  secrets = [
    "GITHUB_TOKEN",
    "NOW_TOKEN",
  ]
}

You will need to provide a Zeit token value for the NOW_TOKEN secret in the Actions visual editor if you haven't already.

To avoid racking up failed deployments, we suggest that you place this action after any linting and test actions.

Now CLI arguments

It's possible to pass additional arguments through to the now CLI via the args field in your workflow action. Because the primer-deploy CLI accepts options of its own (such as --dry-run), you need to prefix any now arguments with --:

action "deploy" {
  uses = "primer/deploy@master"
+  args = "-- --meta autoDeployed=true"

You can also use args to deploy a subdirectory, e.g. docs:

action "deploy" {
  uses = "primer/deploy@master"
+  args = "-- docs"

deploy-6's People

Contributors

shawnbot 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.