Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Automatically deploy your Firebase tools and services

License

NotificationsYou must be signed in to change notification settings

OudyWorks/action-firebase-deploy

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
 
 

Repository files navigation

  • Creates a new Hosting preview channel (and its associated preview URL) for every PR on your GitHub repository.
  • Adds a PR comment with the preview URL.
  • Updates the preview URL with each commit by deploying to the associated preview channel.
  • On production deploys, deploys all Firebase resources by default (no--only). Providetargets to restrict via--only.

Setup

A full setup guide can be foundin the Firebase Hosting docs.

TheFirebase CLI can get you set up quickly with a default configuration.

  • If you've NOT set up Hosting, run this version of the command from the root of your local directory:
firebase init hosting
  • If you've ALREADY set up Hosting, then you just need to set up the GitHub Action part of Hosting.Run this version of the command from the root of your local directory:
firebase init hosting:github

Usage

Deploy to a new preview channel for every PR

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

name:Deploy to Preview Channelon:pull_request:# Optionally configure to run only for specific files. For example:# paths:# - "website/**"jobs:build_and_preview:runs-on:ubuntu-lateststeps:      -uses:actions/checkout@v4# Add any build steps here. For example:# - run: npm ci && npm run build      -uses:FirebaseExtended/action-hosting-deploy@v0with:repoToken:"${{ secrets.GITHUB_TOKEN }}"firebaseServiceAccount:"${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"expires:30dprojectId:your-Firebase-project-ID

Deploy to your live channel on merge

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

name:Deploy to Live Channelon:push:branches:      -main# Optionally configure to run only for specific files. For example:# paths:# - "website/**"jobs:deploy_live_website:runs-on:ubuntu-lateststeps:      -uses:actions/checkout@v4# Add any build steps here. For example:# - run: npm ci && npm run build      -uses:FirebaseExtended/action-hosting-deploy@v0with:firebaseServiceAccount:"${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"projectId:your-Firebase-project-IDchannelId:live

Options

firebaseServiceAccount{string}

This is a service account JSON key. The easiest way to set it up is to runfirebase init hosting:github. However, it can also becreated manually.

It's important to store this token as anencrypted secretto prevent unintended access to your Firebase project. Set it in the "Secrets" areaof your repository settings and add it asFIREBASE_SERVICE_ACCOUNT:https://github.com/USERNAME/REPOSITORY/settings/secrets.

repoToken{string}

firebaseToken{string}

A Firebase CI token used to authenticate the Firebase CLI (passed via--token).Use this if you prefer not to use a service account.

Authentication requirement: provide eitherfirebaseServiceAccount orfirebaseToken. If neither is provided, the action will fail.

Examples:

Service account auth:

with:firebaseServiceAccount:"${{ secrets.FIREBASE_SERVICE_ACCOUNT }}"

Token auth:

with:firebaseToken:"${{ secrets.FIREBASE_TOKEN }}"

AddingrepoToken: "${{secrets.GITHUB_TOKEN}}" lets the action comment on PRswith the preview URL for the associated preview channel. You don't need to setthis secret yourself - GitHub sets it automatically.

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

expires{string}

The length of time the preview channel should remain active after the last deploy.If left blank, the action uses the default expiry of 7 days.The expiry date will reset to this value on every new deployment.

projectId{string}

The Firebase project that contains the Hosting site to which youwant to deploy. If left blank, you need to check in a.firebasercfile so that the Firebase CLI knows which Firebase project to use.

channelId{string}

The ID of the channel to deploy to. If you leave this blank,a preview channel and its ID will be auto-generated per branch or PR.If you set it tolive, the action deploys to the live channel of your default Hosting site.

You usually want to leave this blank so that each PR gets its own preview channel.An exception might be that you always want to deploy a certain branch to along-lived preview channel (for example, you may want to deploy every commitfrom yournext branch to apreprod preview channel).

targets{string list}

Optional list of Firebase deploy targets to pass to the CLI via--only.

  • When set, production deploys will run:firebase deploy --only <targets>
  • When omitted, production deploys will run:firebase deploy (deploys all configured resources)
  • Preview deploys always usefirebase hosting:channel:deploy; whentargets is set,--only <targets> is added

Provide as a multiline input or comma-separated values. Examples:

with:targets:|    hosting    firestore    functions:myFunc

or

with:targets:hosting,firestore,functions:myFunc

entryPoint{string}

The directory containing yourfirebase.jsonfile relative to the root of your repository. Defaults to. (the root of your repo).

firebaseToolsVersion{string}

The version offirebase-tools to use. If not specified, defaults tolatest.

disableComment{boolean}

Disable commenting in a PR with the preview URL.

config{string}

The Firebase config file to use, passed to the CLI via--config. Relative toentryPoint.Defaults tofirebase.json.

Example:

with:entryPoint:.config:firebase.prod.json

Outputs

Values emitted by this action that can be consumed by other actions later in your workflow

urls

The url(s) deployed to

expire_time

The time the deployed preview urls expire, example: 2024-04-10T14:37:53.817800922Z

expire_time_formatted

The time the deployed preview urls expire in the UTC format, example: Tue, 09 Apr 2024 18:24:42 GMT

details_url

A single URL that was deployed to

Status

Status: Experimental

This repository is maintained by Googlers but is not a supported Firebase product. Issues here are answered by maintainers and other community members on GitHub on a best-effort basis.

About

Automatically deploy your Firebase tools and services

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • TypeScript100.0%

[8]ページ先頭

©2009-2025 Movatter.jp