Skip to content

Commit 49e2afc

Browse files
authored
Upgrade action and README.md (w9jds#7)
- A lot has changed since the initial beta of actions, this update will bring it up to par with the current way actions are configured. - The example also shows how to pass a build artifact to the deployment job.
1 parent 7d6b2b0 commit 49e2afc

File tree

4 files changed

+64
-21
lines changed

4 files changed

+64
-21
lines changed

Dockerfile

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
21
FROM node:10-slim
32

4-
LABEL version="1.0.0"
3+
LABEL version="1.1.0"
54
LABEL repository="https://github.com/w9jds/firebase-action"
65
LABEL homepage="https://github.com/w9jds/firebase-action"
76
LABEL maintainer="Jeremy Shore <[email protected]>"
87

9-
LABEL com.github.actions.name="GitHub Action for Firebase"
10-
LABEL com.github.actions.description="Wraps the firebase-tools CLI to enable common commands."
11-
LABEL com.github.actions.icon="package"
12-
LABEL com.github.actions.color="gray-dark"
13-
148
RUN npm install -g firebase-tools
159

1610
COPY LICENSE README.md /

README.md

+52-13
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,68 @@
22

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

5-
### Secrets
5+
## Inputs
6+
7+
* `args` - **Required**. This is the arguments you want to use for the `firebase` cli
68

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

9-
### Environment variables
10+
## Environment variables
11+
12+
* `FIREBASE_TOKEN` - **Required**. The token to use for authentication. This token can be aquired through the `firebase login:ci` command.
1013

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

13-
#### Example
16+
## Example
1417

1518
To authenticate with Firebase, and deploy to Firebase Hosting:
1619

17-
```hcl
18-
action "Deploy Production Site" {
19-
uses = "w9jds/firebase-action@master"
20-
args = "deploy --only hosting:prod"
21-
env = {
22-
PROJECT_ID = "new-eden-storage-a5c23"
23-
}
24-
secrets = ["FIREBASE_TOKEN"]
25-
}
20+
```yaml
21+
name: Build and Deploy
22+
on:
23+
push:
24+
branches:
25+
- master
26+
27+
jobs:
28+
build:
29+
name: Build
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout Repo
33+
uses: actions/checkout@master
34+
- name: Install Dependencies
35+
run: npm install
36+
- name: Build
37+
run: npm run build-prod
38+
- name: Archive Production Artifact
39+
uses: actions/upload-artifact@master
40+
with:
41+
name: dist
42+
path: dist
43+
deploy:
44+
name: Deploy
45+
needs: build
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Checkout Repo
49+
uses: actions/checkout@master
50+
- name: Download Artifact
51+
uses: actions/download-artifact@master
52+
with:
53+
name: dist
54+
- name: Deploy to Firebase
55+
uses: w9jds/firebase-action@develop
56+
with:
57+
args: deploy --only hosting:prod
58+
env:
59+
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
2660
```
2761
2862
## License
2963
3064
The Dockerfile and associated scripts and documentation in this project are released under the [MIT License](LICENSE).
65+
66+
67+
### Recommendation
68+
69+
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`)

action.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: 'GitHub Action for Firebase'
2+
author: 'Jeremy Shore'
3+
description: 'Wraps the firebase-tools CLI to enable common commands.'
4+
branding:
5+
icon: 'package'
6+
color: 'gray-dark'
7+
runs:
8+
using: 'docker'
9+
image: 'Dockerfile'

entrypoint.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/sh
1+
#!/bin/sh -l
22

33
set -e
44

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

1010
if [ -n "$PROJECT_ID" ]; then
11+
echo "setting firebase project to $PROJECT_ID"
1112
firebase use --add $PROJECT_ID
1213
fi
1314

0 commit comments

Comments
 (0)