From 229f0d32cbcb7946733546cfe84899d4396f5171 Mon Sep 17 00:00:00 2001 From: Jeremy Shore Date: Thu, 19 Sep 2019 22:09:53 -0500 Subject: [PATCH 1/6] Update action to the newer types --- action.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 action.yaml diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000..fc1a97f --- /dev/null +++ b/action.yaml @@ -0,0 +1,15 @@ +name: 'GitHub Action for Firebase' +author: 'Jeremy Shore' +description: 'Wraps the firebase-tools CLI to enable common commands.' +branding: + icon: 'package' + color: 'gray-dark' +inputs: + command: + description: 'firebase-tools command to run' + require: true +runs: + using: 'docker' + image: 'Dockerfile' + args: + - ${{ inputs.command }} \ No newline at end of file From cd1c0a7d41444f25be23163bb9262a5153e1424b Mon Sep 17 00:00:00 2001 From: Jeremy Shore Date: Thu, 19 Sep 2019 22:12:47 -0500 Subject: [PATCH 2/6] Update Inputs --- Dockerfile | 8 +------- action.yaml | 1 + 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index e6cb9b7..8cd9a8b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,15 +6,9 @@ LABEL repository="https://github.com/w9jds/firebase-action" LABEL homepage="https://github.com/w9jds/firebase-action" LABEL maintainer="Jeremy Shore " -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 / COPY "entrypoint.sh" "/entrypoint.sh" -ENTRYPOINT ["/entrypoint.sh"] -CMD ["--help"] \ No newline at end of file +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/action.yaml b/action.yaml index fc1a97f..fc04477 100644 --- a/action.yaml +++ b/action.yaml @@ -8,6 +8,7 @@ inputs: command: description: 'firebase-tools command to run' require: true + default: '--help' runs: using: 'docker' image: 'Dockerfile' From d38efe2f9c673647db2fa57a4a8d20515895f641 Mon Sep 17 00:00:00 2001 From: Jeremy Shore Date: Fri, 20 Sep 2019 01:35:41 -0500 Subject: [PATCH 3/6] Update README for newer version of actions --- Dockerfile | 2 +- README.md | 62 ++++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 50 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8cd9a8b..fed5743 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ 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 " diff --git a/README.md b/README.md index f172a61..9992152 100644 --- a/README.md +++ b/README.md @@ -2,29 +2,65 @@ This Action for [firebase-tools](https://github.com/firebase/firebase-tools) enables arbitrary actions with the `firebase` command-line client. -### Secrets +## Inputs + +* `command` - **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 +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@master + with: + command: 'deploy --only hosting:prod' + env: + PROJECT_ID: new-eden-storage-a5c23 + FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} ``` ## License The Dockerfile and associated scripts and documentation in this project are released under the [MIT License](LICENSE). + + +# Hello world docker action + +This action prints "Hello World" or "Hello" + the name of a person to greet to the log. + +## Inputs + +### `who-to-greet` + +**Required** The name of the person to greet. Default `"World"`. + +## Outputs + +### `time` + +The time we greeted you. + +## Example usage + +uses: actions/hello-world-docker-action@v1 +with: + who-to-greet: 'Mona the Octocat' \ No newline at end of file From 253b68304b3084ece12cf41e6725a67b787a0bdb Mon Sep 17 00:00:00 2001 From: Jeremy Shore Date: Fri, 20 Sep 2019 07:33:30 -0500 Subject: [PATCH 4/6] Added some outputs for logs --- entrypoint.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index cadb08e..c55a553 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh -l set -e @@ -8,7 +8,9 @@ if [ -z "$FIREBASE_TOKEN" ]; then fi if [ -n "$PROJECT_ID" ]; then + echo "setting firebase project $PROJECT_ID" firebase use --add $PROJECT_ID fi +echo "Running firebase $*" sh -c "firebase $*" From 7ab8ff8fb04f6005a8c456d8062e0eaed86d1b3d Mon Sep 17 00:00:00 2001 From: Jeremy Shore Date: Fri, 20 Sep 2019 18:37:41 -0500 Subject: [PATCH 5/6] Going back to the way it used to work --- Dockerfile | 4 ++-- action.yaml | 9 +-------- entrypoint.sh | 3 +-- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Dockerfile b/Dockerfile index fed5743..c6f2212 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,3 @@ - FROM node:10-slim LABEL version="1.1.0" @@ -11,4 +10,5 @@ RUN npm install -g firebase-tools COPY LICENSE README.md / COPY "entrypoint.sh" "/entrypoint.sh" -ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["/entrypoint.sh"] +CMD ["--help"] \ No newline at end of file diff --git a/action.yaml b/action.yaml index fc04477..682c143 100644 --- a/action.yaml +++ b/action.yaml @@ -4,13 +4,6 @@ description: 'Wraps the firebase-tools CLI to enable common commands.' branding: icon: 'package' color: 'gray-dark' -inputs: - command: - description: 'firebase-tools command to run' - require: true - default: '--help' runs: using: 'docker' - image: 'Dockerfile' - args: - - ${{ inputs.command }} \ No newline at end of file + image: 'Dockerfile' \ No newline at end of file diff --git a/entrypoint.sh b/entrypoint.sh index c55a553..6e1db44 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,9 +8,8 @@ if [ -z "$FIREBASE_TOKEN" ]; then fi if [ -n "$PROJECT_ID" ]; then - echo "setting firebase project $PROJECT_ID" + echo "setting firebase project to $PROJECT_ID" firebase use --add $PROJECT_ID fi -echo "Running firebase $*" sh -c "firebase $*" From 9733f337cf7da10602717d5bc75fda542d01d19a Mon Sep 17 00:00:00 2001 From: Jeremy Shore Date: Fri, 20 Sep 2019 19:38:16 -0500 Subject: [PATCH 6/6] Update README to reflect the new action config --- README.md | 81 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 9992152..57c2218 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This Action for [firebase-tools](https://github.com/firebase/firebase-tools) ena ## Inputs -* `command` - **Required**. This is the arguments you want to use for the `firebase` cli +* `args` - **Required**. This is the arguments you want to use for the `firebase` cli ## Environment variables @@ -18,24 +18,45 @@ This Action for [firebase-tools](https://github.com/firebase/firebase-tools) ena To authenticate with Firebase, and deploy to Firebase Hosting: ```yaml -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@master - with: - command: 'deploy --only hosting:prod' - env: - PROJECT_ID: new-eden-storage-a5c23 - FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }} +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 @@ -43,24 +64,6 @@ deploy: The Dockerfile and associated scripts and documentation in this project are released under the [MIT License](LICENSE). -# Hello world docker action +### Recommendation -This action prints "Hello World" or "Hello" + the name of a person to greet to the log. - -## Inputs - -### `who-to-greet` - -**Required** The name of the person to greet. Default `"World"`. - -## Outputs - -### `time` - -The time we greeted you. - -## Example usage - -uses: actions/hello-world-docker-action@v1 -with: - who-to-greet: 'Mona the Octocat' \ No newline at end of file +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`) \ No newline at end of file