mirror of
https://github.com/rjNemo/devbook_ts
synced 2026-06-06 02:36:39 +00:00
ℹ️ Ci (#10)
* fix error in README * check github.ref value * check github.ref value * fix typo * install deps * track config files * final versioning
This commit is contained in:
parent
9242d284c7
commit
75c9888493
6 changed files with 121 additions and 11 deletions
5
.firebaserc
Normal file
5
.firebaserc
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"projects": {
|
||||
"default": "devprojects-4749c"
|
||||
}
|
||||
}
|
||||
15
.github/workflows/deploy.yml
vendored
15
.github/workflows/deploy.yml
vendored
|
|
@ -26,15 +26,18 @@ jobs:
|
|||
start: yarn start
|
||||
wait-on: 'http://localhost:3000'
|
||||
release:
|
||||
if: ${{ github.ref == 'master' }}
|
||||
needs: test
|
||||
name: Release
|
||||
if: ${{ github.ref == 'refs/heads/master' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
- name: Build
|
||||
run: yarn build
|
||||
- name: Install Firebase CLI tools
|
||||
run: yarn global add firebase-tools
|
||||
- name: Deploy
|
||||
run: firebase deploy --token ${{ secrets.FIREBASE_TOKEN }}
|
||||
- name: Deploy to Firebase
|
||||
uses: w9jds/firebase-action@master
|
||||
with:
|
||||
args: deploy
|
||||
env:
|
||||
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
|
||||
|
|
|
|||
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -28,8 +28,4 @@ yarn-debug.log*
|
|||
yarn-error.log*
|
||||
|
||||
.env
|
||||
.firebase
|
||||
firebase.json
|
||||
firestore.indexes.json
|
||||
*rules
|
||||
.firebaserc
|
||||
.firebase
|
||||
23
firebase.json
Normal file
23
firebase.json
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"firestore": {
|
||||
"rules": "firestore.rules",
|
||||
"indexes": "firestore.indexes.json"
|
||||
},
|
||||
"hosting": {
|
||||
"public": "build",
|
||||
"ignore": [
|
||||
"firebase.json",
|
||||
"**/.*",
|
||||
"**/node_modules/**"
|
||||
],
|
||||
"rewrites": [
|
||||
{
|
||||
"source": "**",
|
||||
"destination": "/index.html"
|
||||
}
|
||||
]
|
||||
},
|
||||
"storage": {
|
||||
"rules": "storage.rules"
|
||||
}
|
||||
}
|
||||
75
firestore.rules
Normal file
75
firestore.rules
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
rules_version = '2';
|
||||
service cloud.firestore {
|
||||
match /databases/{database}/documents {
|
||||
// Restaurants:
|
||||
// - Authenticated user can read
|
||||
// - Authenticated user can create/update (for demo)
|
||||
// - Validate updates
|
||||
// - Deletes are not allowed
|
||||
match /restaurants/{restaurantId} {
|
||||
allow read, create: if request.auth != null;
|
||||
allow update: if request.auth != null
|
||||
&& request.resource.data.name == resource.data.name
|
||||
allow delete: if false;
|
||||
|
||||
// Ratings:
|
||||
// - Authenticated user can read
|
||||
// - Authenticated user can create if userId matches
|
||||
// - Deletes and updates are not allowed
|
||||
match /ratings/{ratingId} {
|
||||
allow read: if request.auth != null;
|
||||
allow create: if request.auth != null
|
||||
&& request.resource.data.userId == request.auth.uid;
|
||||
allow update, delete: if false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// MealPlannerUsers:
|
||||
// - Anyone can read
|
||||
// - Authenticated users can create and edit their account
|
||||
// - Deletes are not allowed
|
||||
match /mealPlannerUsers/{userID} {
|
||||
allow read: if true;
|
||||
allow create, update, write: if true;
|
||||
allow delete: if false;
|
||||
|
||||
// Favs:
|
||||
// - Anyone can read
|
||||
// - Authenticated users can create and edit their account
|
||||
// - Deletes are not allowed
|
||||
match /favs/{favID} {
|
||||
allow read, create, update, write: if true;
|
||||
allow delete: if false;
|
||||
}
|
||||
}
|
||||
|
||||
// Messages:
|
||||
// - Anyone can read.
|
||||
// - Authenticated users can add and edit messages.
|
||||
// - Validation: Check name is same as auth token and text length below 300 char or that imageUrl is a URL.
|
||||
// - Deletes are not allowed.
|
||||
match /messages/{messageId} {
|
||||
allow read;
|
||||
allow create, update: if request.auth != null
|
||||
&& request.resource.data.name == request.auth.token.name
|
||||
&& (request.resource.data.text is string
|
||||
&& request.resource.data.text.size() <= 300
|
||||
|| request.resource.data.imageUrl is string
|
||||
&& request.resource.data.imageUrl.matches('https?://.*'));
|
||||
allow delete: if false;
|
||||
}
|
||||
|
||||
// FcmTokens:
|
||||
// - anyone can save its token
|
||||
// - access is forbidden
|
||||
match /fcmTokens/{tokenID} {
|
||||
allow write;
|
||||
allow read: if false;
|
||||
}
|
||||
// Users: DevBook app
|
||||
match /users/{userID} {
|
||||
allow read,write :if true;
|
||||
}
|
||||
}
|
||||
}
|
||||
8
storage.rules
Normal file
8
storage.rules
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
rules_version = '2';
|
||||
service firebase.storage {
|
||||
match /b/{bucket}/o {
|
||||
match /{allPaths=**} {
|
||||
allow read, write: if request.auth!=null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue