Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Nishanth Shankar committed Jan 10, 2020
1 parent 17e2620 commit ff4d3ae
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 57 deletions.
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
FROM node:10-slim

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 <w9jds@github.com>"
LABEL repository="https://github.com/NishanthShankar/codepush-action"
LABEL homepage="https://github.com/NishanthShankar/codepush-action"
LABEL maintainer="Nishanth Shankar <nishanthShankr@gmail.com>"

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.name="GitHub Action for Codepush"
LABEL com.github.actions.description="Wraps the appcenter CLI to enable common commands."
LABEL com.github.actions.icon="package"
LABEL com.github.actions.color="gray-dark"

RUN npm install -g firebase-tools
RUN npm install -g appcenter-cli

COPY LICENSE README.md /
COPY "entrypoint.sh" "/entrypoint.sh"
Expand Down
49 changes: 12 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
# GitHub Actions for Firebase

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

## Inputs

* `args` - **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 `appcenter` cli


## 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.

* `PROJECT_PATH` - **Optional**. The path to `firebase.json` if it doesn't exist at the root of your repository. e.g. `./my-app`
* `APPCENTER_ACCESS_TOKEN` - **Required**. The token to use for authentication. This token can be aquired through the `appcenter dashboard`.

## Example

To authenticate with Firebase, and deploy to Firebase Hosting:
To authenticate with Codepush, and deploy to Codepush:

```yaml
name: Build and Deploy
Expand All @@ -27,48 +23,27 @@ on:
- 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@master
- name: Install Dependencies
run: npm install
- name: Deploy to Codepush
uses: NishanthShankar/codepush-action@master
with:
args: deploy --only hosting
args: release-react -d Production
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
APPCENTER_ACCESS_TOKEN: ${{ secrets.APPCENTER_ACCESS_TOKEN }}
```

If you have multiple hosting environments you can specify which one in the args line.
e.g. `args: deploy --only hosting:[environment name]`

## 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`)
### Credits
Thanks to [Jeremy Shore](https://github.com/w9jds) for the firebase-action repo.
6 changes: 3 additions & 3 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'GitHub Action for Firebase'
author: 'Jeremy Shore'
description: 'Wraps the firebase-tools CLI to enable common commands.'
name: 'GitHub Action for Codepush'
author: 'Nishanth Shankar'
description: 'Wraps the appcenter CLI to enable common commands.'
branding:
icon: 'package'
color: 'gray-dark'
Expand Down
14 changes: 3 additions & 11 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@

set -e

if [ -z "$FIREBASE_TOKEN" ]; then
echo "FIREBASE_TOKEN is required to run commands with the firebase cli"
if [ -z "$APPCENTER_ACCESS_TOKEN" ]; then
echo "APPCENTER_ACCESS_TOKEN is required to run commands with the appcenter cli"
exit 126
fi

if [ -n "$PROJECT_PATH" ]; then
cd $PROJECT_PATH
fi

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

sh -c "firebase $*"
sh -c "appcenter codepush $*"

0 comments on commit ff4d3ae

Please sign in to comment.