Skip to content
This repository was archived by the owner on Mar 2, 2021. It is now read-only.

Commit 2e2ce0c

Browse files
authored
Enable automatic deployments (#38)
Below is tons of tries to get this working. Now it does. * Test CI deploy * Upgrade node version in CI * Install firebase-tools in CI * Try * Try again * Fix function deploys by upgrading firebase deps * Test * Try to run deploys in parallel * Test * Test * Test again * Omg stynax * Try to only install for test stage * Hopefully fix travis syntax * Fix? * Test again * Test branch condition * Update readme with deploy instructions * Only to deploy staging for master branch * Only install firebase-tools when also deploying * Test travis syntax * Test 4237589102 * Test * Test * Move firebase tools to dev dep and refactor travis yml * Prepare for lift off
1 parent a92ed51 commit 2e2ce0c

File tree

4 files changed

+3065
-136
lines changed

4 files changed

+3065
-136
lines changed

.travis.yml

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
language: node_js
2-
node_js: 7
2+
node_js: 9
33
dist: trusty
4+
cache: yarn
45

5-
install:
6-
- yarn install
6+
# Define stages and their scripts
7+
jobs:
8+
include:
9+
- stage: test
10+
script: yarn test
711

8-
script:
9-
- yarn test
12+
- stage: deploy-staging
13+
if: branch IN (master)
14+
script:
15+
- yarn deploy-rules
16+
- yarn deploy-api
17+
18+
- stage: deploy-production
19+
if: branch = production
20+
script:
21+
- yarn deploy-rules-production
22+
- yarn deploy-api-production

README.md

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ not harm the systems or steps out legality.
1111
In this repository you can find:
1212

1313
- [Firebase API](#firebase-api)
14-
- [Rules & Authentication](#rules--authentication)
15-
- [Endpoints](#endpoints)
16-
- [Models](#models)
17-
- [Node.js API](#nodejs-api)
14+
- [Rules & Authentication](#rules--authentication)
15+
- [Endpoints](#endpoints)
16+
- [Models](#models)
17+
- [Node.js API](#nodejs-api)
1818
- [Deployment](#deployment)
1919
- [FAQ](#frequently-and-not-frequently-asked-questions-faqnfaq)
2020

@@ -159,22 +159,24 @@ You can test it using `yarn test` which runs `ava` on the `test` folder.
159159

160160
## Deployment
161161

162-
Before you can deploy either the Firebase security rules or the Node.js API, make sure you have the Firebase tools installed:
162+
The `master` branch will automatically deploy to staging. And `production` branch to production.
163+
164+
Also see the `.travis.yml` file.
165+
166+
To deploy manually, do this:
163167

164168
1. `yarn global add firebase-tools`
165169
2. `firebase login`
166170

167-
**Deploying rules**
171+
**Deploying to staging**
168172

169-
-. Get permissions to the Firebase project `firebase-radio4000`
170-
- `yarn deploy-rules` (staging)
171-
- `yarn deploy-rules-production` (production)
173+
1. `yarn deploy-rules && yarn deploy-api`
174+
2. Visit https://us-central1-radio4000-staging.cloudfunctions.net/api/
172175

173-
**Deploying the Node.js API**
176+
**Deploying to production**
174177

175-
1. Get permission to the Firebase project `radio4000-api`
176-
2. Run `yarn deploy-api-production`
177-
3. Now live at https://api.radio4000.com
178+
1. `yarn deploy-rules-production && yarn deploy-api-production`
179+
2. Visit https://api.radio4000.com/
178180

179181
## Frequently and not-frequently asked questions (FAQNFAQ)
180182

@@ -186,8 +188,9 @@ Firebase allowed this project to come to life without having the need to spend t
186188
- [radio4000.com](https://github.com/internet4000/radio4000): the main website use this exact API via the JavaScript SDK.
187189
- [radio4000-player](https://github.com/internet4000/radio4000-player):
188190
the media player used by radio4000.com is a vue.js project
189-
communicating with this API via REST.
191+
communicating with this API via REST.
190192
- [mix.radio4000.com](https://github.com/internet4000/radio4000-mix):
191193
mix radio4000 channels together
192194

193-
Do you want your project to appear here? Send a pull request or get in touch!
195+
Do you want your project to appear here? Send a pull request or get in touch.
196+

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
"body-parser": "^1.17.2",
1717
"cors": "^2.8.4",
1818
"express": "^4.15.3",
19-
"firebase-admin": "^5.2.1",
20-
"firebase-functions": "^0.6.3",
19+
"firebase-admin": "^5.10.0",
20+
"firebase-functions": "^0.8.2",
2121
"got": "^6.7.1",
2222
"stripe": "^4.24.0"
2323
},
2424
"devDependencies": {
25-
"ava": "^0.21.0"
25+
"ava": "^0.21.0",
26+
"firebase-tools": "^3.17.7"
2627
}
2728
}

0 commit comments

Comments
 (0)