-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from lowply/remove-branch-restriction
Remove branch restriction
- Loading branch information
Showing
2 changed files
with
35 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,50 @@ | ||
# Deploy to Firebase | ||
|
||
A GitHub Action to deploy to Firebase Hosting | ||
A GitHub Action to deploy to Firebase Hosting. | ||
|
||
- You can choose a specific branch to allow deployment by using the `TARGET_BRANCH` env var (`master` if not specified). | ||
- Make sure you have the `firebase.json` file in the repository | ||
- Get the Firebase token by running `firebase login:ci` and [store it](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) as the `FIREBASE_TOKEN` secret | ||
- Set the project name in the `FIREBASE_PROJECT` env var | ||
- Make sure that you checkout the repository using the [actions/checkout](https://github.com/actions/checkout) action | ||
- Make sure that you have the `firebase.json` file in the repository | ||
- To obtain the Firebase token, run `firebase login:ci` on your local computer and [store the token](https://docs.github.com/en/actions/reference/encrypted-secrets#creating-encrypted-secrets-for-a-repository) as the `FIREBASE_TOKEN` secret | ||
- Specify the Firebase project name in the `FIREBASE_PROJECT` env var | ||
|
||
Example workflow | ||
## Workflow examples | ||
|
||
Deploy the `main` branch when a commit is pushed to it: | ||
|
||
``` | ||
name: Build and Deploy | ||
name: Deploy the main branch | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- main | ||
jobs: | ||
main: | ||
name: Deploy to Firebase | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: lowply/deploy-firebase@v0.0.5 | ||
env: | ||
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} | ||
FIREBASE_PROJECT: name-of-the-project | ||
``` | ||
|
||
Deploy only when a tag starts with `v` is pushed: | ||
|
||
``` | ||
name: Deploy a tag | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
jobs: | ||
main: | ||
name: Build and Deploy | ||
name: Deploy to Firebase | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@master | ||
- name: Build Hugo | ||
uses: lowply/build-hugo@v0.68.3 | ||
- name: Deploy to Firebase | ||
uses: lowply/deploy-firebase@v0.0.3 | ||
- uses: actions/checkout@v2 | ||
- uses: lowply/deploy-firebase@v0.0.5 | ||
env: | ||
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} | ||
FIREBASE_PROJECT: name-of-the-project | ||
TARGET_BRANCH: main | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters