|
2 | 2 |
|
3 | 3 | This Action for [firebase-tools](https://github.com/firebase/firebase-tools) enables arbitrary actions with the `firebase` command-line client.
|
4 | 4 |
|
5 |
| -### Secrets |
| 5 | +## Inputs |
| 6 | + |
| 7 | +* `args` - **Required**. This is the arguments you want to use for the `firebase` cli |
6 | 8 |
|
7 |
| -* `FIREBASE_TOKEN` - **Required**. The token to use for authentication. This token can be aquired through the `firebase login:ci` command. |
8 | 9 |
|
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. |
10 | 13 |
|
11 | 14 | * `PROJECT_ID` - **Optional**. To specify a specific project to use for all commands, not required if you specify a project in your `.firebaserc` file.
|
12 | 15 |
|
13 |
| -#### Example |
| 16 | +## Example |
14 | 17 |
|
15 | 18 | To authenticate with Firebase, and deploy to Firebase Hosting:
|
16 | 19 |
|
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 }} |
26 | 60 | ```
|
27 | 61 |
|
28 | 62 | ## License
|
29 | 63 |
|
30 | 64 | 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`) |
0 commit comments