Code Monkey home page Code Monkey logo

deploy-pr-action's Introduction

๐Ÿš€๐ŸŽฌ Deploy PR Action

This is a GitHub Action that automatically deploys all pull requests and branches as a static site using Surge.sh.

Test CI Release CI Node CI

โญ Features

  • Auto-deploy every PR and branch to its unique environment
  • Unlimited free static site deployments, thanks to Surge.sh
  • No search engine indexing for branch sites (robots.txt injection)
  • Label and comment on PRs with the deployment and log URLs
  • Update your staging GitHub environment status

โš™๏ธ Usage

Inputs

distDir (required)

The directory to deploy, for example dist or public

prefix

Prefix for deployment URL, e.g., example will translate to https://example-PR_NAME.surge.sh

robotsTxtPath

Generate a robots.txt file to prevent search engines from indexing the deployment

robotsContent

Content for robots.txt file, defaults to:

User-agent: *
Disallow: /

environmentName

Name of the deployment environment on GitHub, defaults to "Preview"

skipComment

Skip adding the deployment details comment, defaults to false

skipLabels

Skip adding the labels to pull requests, defaults to false

labels

Labels to add to pull requests as a comma-separated list, defaults to deployed

failOnDeployError

Set the status check to "failed" if a deployment error occurs, defaults to false

Environment variables

GITHUB_TOKEN (required)

The GitHub token is required to add labels, comments, etc., on the PR: GITHUB_TOKEN: ${{ secrets.GH_PAT }}

SURGE_LOGIN (required)

Your Surge.sh email address, required to deploy site to Surge.sh

SURGE_TOKEN (required)

Your Surge.sh login token, required to deploy site to Surge.sh (get it by doing surge token)

Example

name: Deploy CI
on:
  issue_comment:
    types: [created]
  push:
    branches-ignore:
      - master
  pull_request:
    types:
      - opened
      - edited
      - synchronize
jobs:
  release:
    name: Deploy website
    runs-on: ubuntu-18.04
    if: "!contains(github.event.head_commit.message, '[skip ci]') && (contains(github.event.comment.body, 'Deploy') || contains(github.event.comment.body, 'deploy') || github.event_name == 'push' || github.event_name == 'pull_request')"
    steps:
      - name: Checkout
        uses: actions/checkout@v1
      - name: Setup Node.js
        uses: actions/setup-node@v1
        with:
          node-version: 12
      - name: Install dependencies
        run: npm ci
      - name: Build static site
        run: npm run build # Build your website
      - name: Deploy
        uses: koj-co/[email protected]
        with:
          prefix: example # Prefix for deployment URL
          robotsTxtPath: dist/robots.txt # Add robots.txt file
          distDir: dist # Path to dist directory
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GitHub token
          SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }} # Surge.sh email
          SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} # Surge.sh token

๐Ÿ“„ License

  • Code: MIT ยฉ Koj
  • "GitHub" is a trademark of GitHub, Inc.

Koj

An open source project by Koj.
Furnish your home in style, for as low as CHF175/month โ†’

deploy-pr-action's People

Contributors

anandchowdhary avatar dependabot[bot] avatar pabio-escobar avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

acrossoffwest

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.