Skip to content

steren/action-hosting-deploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Firebase Hosting Preview: GitHub Action

A GitHub action that builds and deploys preview versions of your PRs and links to them.

Usage:

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

name: Deploy Preview

on: [pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: developit/firebase-hosting-preview-action@v1
        with:
          repo-token: "${{ secrets.GITHUB_TOKEN }}"
          firebase-token: "${{ secrets.FIREBASE_TOKEN }}"
          use-web-tld: true

Options

firebase-token {string} (required)

This is a deploy key you need to generate using the Firebase CLI locally, so that the action can publish your project.

It's important to store this token as an encrypted secret to prevent unintended access your Firebase project. Here's how:

Generating and safely adding the token:

First, generate a token by running firebase login:ci and copying the code it generates.

Then, go to the "Secrets" area of your repository settings and add it as FIREBASE_TOKEN:

https://github.com/USERNAME/REPOSITORY/settings/secrets

repo-token {string}

Adding repo-token: "${{secrets.GITHUB_TOKEN}}" lets the action comment on PRs with the link to the deploy preview. If you omit this option, you'll need to find the preview URL in the action's build log.

build-script {string}

Many projects need to be built before deployment. The action will run the script you provide here before it deploys anything to Firebase.

By default, it will try to build your project using npm run build.

use-web-tld {boolean}

By default, deploy preview URLs will link are PROJECT-HASH.firebaseapp.com. Pass use-web-tld: true to instead use .web.app. The URLs are interchangeable, this option only controls which one the action links to.

About

Automatically deploy shareable previews for your Firebase Hosting sites

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript 100.0%