GithubHelp home page GithubHelp logo

mathiasbynens / action-hosting-deploy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from firebaseextended/action-hosting-deploy

1.0 2.0 0.0 549 KB

License: Apache License 2.0

TypeScript 100.00%

action-hosting-deploy's Introduction

Firebase Hosting GitHub Action

Usage

Deploy a to a new preview channel for every PR

Add a workflow (.github/workflows/deploy-preview.yml):

name: Deploy Preview

on:
  pull_request:
    # Optionally configure to run only for specific files. For example:
    # paths:
    # - "website/**"

jobs:
  build_and_preview:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      # Add any build steps here. For example:
      # - run: npm run build
      - uses: FirebaseExtended/action-hosting-deploy@v1
        with:
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
          expires: 30d
          projectId: your-Firebase-project-ID
        env:
          FIREBASE_CLI_PREVIEWS: hostingchannels

Deploy to your live site on merge

Add a workflow (.github/workflows/deploy-prod.yml):

name: Deploy Production Site

on:
  push:
    branches:
      - master
    # Optionally configure to run only for specific files. For example:
    # paths:
    # - "website/**"

jobs:
  build_and_preview:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      # Add any build steps here. For example:
      # - run: npm run build
      - uses: FirebaseExtended/action-hosting-deploy@v1
        with:
          repoToken: "${{ secrets.GITHUB_TOKEN }}"
          firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"
          expires: 30d
          projectId: your-Firebase-project-ID
          channelId: live

Options

firebaseServiceAccount {string} (required)

This is a service account JSON key.

It's important to store this token as an encrypted secret to prevent unintended access your Firebase project. Set it in the "Secrets" area of your repository settings and add it as FIREBASE_SERVICE_ACCOUNT: https://github.com/USERNAME/REPOSITORY/settings/secrets

repoToken {string}

Adding repoToken: "${{secrets.GITHUB_TOKEN}}" lets the action comment on PRs with the link to the deploy preview. You don't need to set this secret yourself - github will set it automatically.

If you omit this option, you'll need to find the preview URL in the action's build log.

expires {string}

The length of time the channel should live. Default is 7 days.

projectId {string}

The project to deploy to. If you leave this blank, be sure to check in a .firebaserc file so the CLI knows what project to deploy to.

channelId {string}

The channel to deploy to. If you don't set it, a new channel will be created per-PR or per-branch. If you set it to live, the action will deploy to your production Hosting site.

You usually want to leave this blank so that each PR gets its own channel, unless you know you want to deploy a certain branch to a long-lived channel (for example, you may want to deploy every commit from your next branch to a preprod channel)


This GitHub Action is not an officially supported Google product

action-hosting-deploy's People

Contributors

developit avatar jhuleatt avatar

Stargazers

 avatar

Watchers

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