Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade action and README.md #7

Merged
merged 6 commits into from
Sep 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@

FROM node:10-slim

LABEL version="1.0.0"
LABEL version="1.1.0"
LABEL repository="https://github.com/w9jds/firebase-action"
LABEL homepage="https://github.com/w9jds/firebase-action"
LABEL maintainer="Jeremy Shore <[email protected]>"

LABEL com.github.actions.name="GitHub Action for Firebase"
LABEL com.github.actions.description="Wraps the firebase-tools CLI to enable common commands."
LABEL com.github.actions.icon="package"
LABEL com.github.actions.color="gray-dark"

RUN npm install -g firebase-tools

COPY LICENSE README.md /
Expand Down
65 changes: 52 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,68 @@

This Action for [firebase-tools](https://github.com/firebase/firebase-tools) enables arbitrary actions with the `firebase` command-line client.

### Secrets
## Inputs

* `args` - **Required**. This is the arguments you want to use for the `firebase` cli

* `FIREBASE_TOKEN` - **Required**. The token to use for authentication. This token can be aquired through the `firebase login:ci` command.

### Environment variables
## Environment variables

* `FIREBASE_TOKEN` - **Required**. The token to use for authentication. This token can be aquired through the `firebase login:ci` command.

* `PROJECT_ID` - **Optional**. To specify a specific project to use for all commands, not required if you specify a project in your `.firebaserc` file.

#### Example
## Example

To authenticate with Firebase, and deploy to Firebase Hosting:

```hcl
action "Deploy Production Site" {
uses = "w9jds/firebase-action@master"
args = "deploy --only hosting:prod"
env = {
PROJECT_ID = "new-eden-storage-a5c23"
}
secrets = ["FIREBASE_TOKEN"]
}
```yaml
name: Build and Deploy
on:
push:
branches:
- master

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build-prod
- name: Archive Production Artifact
uses: actions/upload-artifact@master
with:
name: dist
path: dist
deploy:
name: Deploy
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
- name: Download Artifact
uses: actions/download-artifact@master
with:
name: dist
- name: Deploy to Firebase
uses: w9jds/firebase-action@develop
with:
args: deploy --only hosting:prod
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
```

## License

The Dockerfile and associated scripts and documentation in this project are released under the [MIT License](LICENSE).


### Recommendation

If you decide to do seperate jobs for build and deployment (which is probably advisable), then make sure to clone your repo as the Firebase-cli requires the firebase repo to deploy (specifically the `firebase.json`)
9 changes: 9 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: 'GitHub Action for Firebase'
author: 'Jeremy Shore'
description: 'Wraps the firebase-tools CLI to enable common commands.'
branding:
icon: 'package'
color: 'gray-dark'
runs:
using: 'docker'
image: 'Dockerfile'
3 changes: 2 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh -l

set -e

Expand All @@ -8,6 +8,7 @@ if [ -z "$FIREBASE_TOKEN" ]; then
fi

if [ -n "$PROJECT_ID" ]; then
echo "setting firebase project to $PROJECT_ID"
firebase use --add $PROJECT_ID
fi

Expand Down