- List deployed versions
- Get the currently active version
- Rollback a specified version
name: Rollback deploy
on:
push:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Get current active version
- uses: igorgottschalg/firebase-rollback-hosting-action@v1
id: current_version
with:
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
projectId: your-Firebase-project-ID
# Deploy a new version
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
projectId: your-Firebase-project-ID
# Rollback to last active version of step id current_version
- uses: igorgottschalg/firebase-rollback-hosting-action@v1
with:
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
projectId: your-Firebase-project-ID
versionName: ${{ steps.current_version.outputs.current_version }}
This is a service account JSON key. The easiest way to set it up is to run firebase init hosting:github
. However, it can also be created manually.
It's important to store this token as an
encrypted secret
to prevent unintended access to 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
.
The Firebase project contains the Hosting site to which you
want to deploy. If left blank, you need to check in a .firebaserc
file so that the Firebase CLI knows which Firebase project to use.
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 to live
, 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 preview channel.
An exception might be that you always want to deploy a certain branch to a
long-lived preview channel (for example, you may want to deploy every commit
from your next
branch to a preprod
preview channel).
The versionName of the deployed version of the site to roll back. If you leave this blank, the action will return all versions and the currently active version on outputs.
If you specify, will be rollback to the version.
The directory containing your firebase.json
file relative to the root of your repository. Defaults to .
(the root of your repo).
Values emitted by this action can be consumed by other actions later in your workflow
The deployed releases version
The current active version