-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e350f86
Showing
14 changed files
with
566 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[{package,bower}.json] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[{.eslintrc,.scss-lint.yml}] | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
[*.{scss,sass}] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"projects": { | ||
"production": "fir-template-40a59", | ||
"staging": "fir-template-staging", | ||
"development": "fir-template-development", | ||
"default": "fir-template-40a59" | ||
}, | ||
"targets": { | ||
"fir-template-development": { | ||
"hosting": { | ||
"website": [ | ||
"fir-template-website-development" | ||
], | ||
"api": [ | ||
"fir-template-api-development" | ||
] | ||
} | ||
}, | ||
"fir-template-staging": { | ||
"hosting": { | ||
"website": [ | ||
"fir-template-website-staging" | ||
], | ||
"api": [ | ||
"fir-template-api-staging" | ||
] | ||
} | ||
}, | ||
"fir-template-40a59": { | ||
"hosting": { | ||
"website": [ | ||
"fir-template-website" | ||
], | ||
"api": [ | ||
"fir-template-api" | ||
] | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Deploy Database, Storage, Firestore | ||
on: | ||
push: | ||
branches: | ||
- dev | ||
env: | ||
NODE_VERSION: 20 | ||
TOKEN_FOR_WORKFLOW: ${{ secrets.TOKEN_FOR_WORKFLOW }} | ||
FIREBASE_PROJECT: "development" | ||
GOOGLE_APPLICATION_CREDENTIALS: ${{ github.workspace }}/firebase/functions/accounts/development.json | ||
BRANCH: "dev" | ||
FIREBASE_CHILD_REPO: "dudko-dev/firebase-template-functions" | ||
FIREBASE_CHILD_BRANCH: "dev" | ||
jobs: | ||
deploy: | ||
name: Deploy Database, Storage, Firestore | ||
runs-on: ubuntu-latest | ||
env: | ||
ENVKEY: ${{ secrets.ENVKEY }} | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Сheckout firebase repo (${{ github.repository }}) | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ github.repository }} | ||
ref: ${{ github.ref }} | ||
path: "firebase" | ||
- name: Сheckout firebase functions repo (${{ env.FIREBASE_CHILD_REPO }}) | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ env.FIREBASE_CHILD_REPO }} | ||
ref: refs/heads/${{ env.FIREBASE_CHILD_BRANCH }} | ||
token: ${{ env.TOKEN_FOR_WORKFLOW }} | ||
path: "firebase/functions" | ||
- name: Change mode directory | ||
run: chmod 0766 -R firebase | ||
working-directory: ${{ github.workspace }} | ||
- name: Install node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- name: Install deploy dependencies | ||
run: sudo npm install firebase-tools -g | ||
working-directory: ${{ github.workspace }}/firebase | ||
- name: Export envkey to file | ||
run: echo "$ENVKEY">./.envkey | ||
working-directory: ${{ github.workspace }}/firebase/functions | ||
- name: Decrypt env and accounts files | ||
run: npm run decrypt | ||
working-directory: ${{ github.workspace }}/firebase/functions | ||
- name: Select firebase project | ||
run: firebase use $FIREBASE_PROJECT | ||
working-directory: ${{ github.workspace }}/firebase | ||
- name: Deploy to firebase | ||
run: firebase deploy -m "Autodeploy from GitHUB ($GITHUB_ACTOR)" --only database,storage,firestore | ||
working-directory: ${{ github.workspace }}/firebase | ||
- name: The job has failed - archive result | ||
if: ${{ failure() }} | ||
run: | | ||
if [[ -d ${{ github.workspace }}/firebase ]]; then | ||
tar -czf firebase.tar.gz firebase; | ||
fi | ||
working-directory: ${{ github.workspace }} | ||
- name: The job has failed - archive npm logs | ||
if: ${{ failure() }} | ||
run: | | ||
if [[ -d /home/runner/.npm/_logs ]]; then | ||
tar -czf ${{ github.workspace }}/npm-logs.tar.gz /home/runner/.npm/_logs; | ||
fi | ||
working-directory: / | ||
- name: The job has failed - upload artifacts | ||
if: ${{ failure() }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.FIREBASE_PROJECT }}-firebase-debug | ||
path: | | ||
${{ github.workspace }}/firebase.tar.gz | ||
${{ github.workspace }}/npm-logs.tar.gz | ||
retention-days: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Deploy Database, Storage, Firestore | ||
on: | ||
push: | ||
branches: | ||
- main | ||
env: | ||
NODE_VERSION: 20 | ||
TOKEN_FOR_WORKFLOW: ${{ secrets.TOKEN_FOR_WORKFLOW }} | ||
FIREBASE_PROJECT: "production" | ||
GOOGLE_APPLICATION_CREDENTIALS: ${{ github.workspace }}/firebase/functions/accounts/production.json | ||
BRANCH: "main" | ||
FIREBASE_CHILD_REPO: "dudko-dev/firebase-template-functions" | ||
FIREBASE_CHILD_BRANCH: "main" | ||
jobs: | ||
deploy: | ||
name: Deploy Database, Storage, Firestore | ||
runs-on: ubuntu-latest | ||
env: | ||
ENVKEY: ${{ secrets.ENVKEY }} | ||
timeout-minutes: 10 | ||
steps: | ||
- name: Сheckout firebase repo (${{ github.repository }}) | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ github.repository }} | ||
ref: ${{ github.ref }} | ||
path: "firebase" | ||
- name: Сheckout firebase functions repo (${{ env.FIREBASE_CHILD_REPO }}) | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: ${{ env.FIREBASE_CHILD_REPO }} | ||
ref: refs/heads/${{ env.FIREBASE_CHILD_BRANCH }} | ||
token: ${{ env.TOKEN_FOR_WORKFLOW }} | ||
path: "firebase/functions" | ||
- name: Change mode directory | ||
run: chmod 0766 -R firebase | ||
working-directory: ${{ github.workspace }} | ||
- name: Install node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
- name: Install deploy dependencies | ||
run: sudo npm install firebase-tools -g | ||
working-directory: ${{ github.workspace }}/firebase | ||
- name: Export envkey to file | ||
run: echo "$ENVKEY">./.envkey | ||
working-directory: ${{ github.workspace }}/firebase/functions | ||
- name: Decrypt env and accounts files | ||
run: npm run decrypt | ||
working-directory: ${{ github.workspace }}/firebase/functions | ||
- name: Select firebase project | ||
run: firebase use $FIREBASE_PROJECT | ||
working-directory: ${{ github.workspace }}/firebase | ||
- name: Deploy to firebase | ||
run: firebase deploy -m "Autodeploy from GitHUB ($GITHUB_ACTOR)" --only database,storage,firestore | ||
working-directory: ${{ github.workspace }}/firebase | ||
- name: The job has failed - archive result | ||
if: ${{ failure() }} | ||
run: | | ||
if [[ -d ${{ github.workspace }}/firebase ]]; then | ||
tar -czf firebase.tar.gz firebase; | ||
fi | ||
working-directory: ${{ github.workspace }} | ||
- name: The job has failed - archive npm logs | ||
if: ${{ failure() }} | ||
run: | | ||
if [[ -d /home/runner/.npm/_logs ]]; then | ||
tar -czf ${{ github.workspace }}/npm-logs.tar.gz /home/runner/.npm/_logs; | ||
fi | ||
working-directory: / | ||
- name: The job has failed - upload artifacts | ||
if: ${{ failure() }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ env.FIREBASE_PROJECT }}-firebase-debug | ||
path: | | ||
${{ github.workspace }}/firebase.tar.gz | ||
${{ github.workspace }}/npm-logs.tar.gz | ||
retention-days: 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
.DS_Store | ||
.firebase | ||
/functions/ | ||
/hosting/website/ | ||
/hosting/api/ | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"editor.codeActionsOnSave": { | ||
"source.fixAll.eslint": "explicit" | ||
}, | ||
"editor.formatOnSave": true, | ||
"[json]": { | ||
"editor.insertSpaces": true, | ||
"editor.tabSize": 2, | ||
"editor.autoIndent": "full", | ||
"editor.folding": true, | ||
"editor.renderWhitespace": "all" | ||
}, | ||
"[javascript]": { | ||
"editor.insertSpaces": true, | ||
"editor.tabSize": 2, | ||
"editor.autoIndent": "full", | ||
"editor.folding": true, | ||
"editor.renderWhitespace": "all" | ||
}, | ||
"eslint.validate": [ | ||
"javascript", | ||
"javascriptreact", | ||
{ | ||
"language": "typescript", | ||
"autoFix": true | ||
}, | ||
{ | ||
"language": "typescriptreact", | ||
"autoFix": true | ||
} | ||
], | ||
"files.associations": { | ||
"*.json": "jsonc" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Firebase Template | ||
|
||
This is part of the [firebase-template project](!https://github.com/search?q=topic%3Afirebase-template+org%3Adudko-dev&type=Repositories), which consists of: | ||
|
||
- `firebase` - firebase settings, including hosting settings and basic access rights, repo: [dudko-dev/firebase-template](https://github.com/dudko-dev/firebase-template) | ||
- `firebase/functions` - gRPC and http cloud functions, repo: [dudko-dev/firebase-template-functions](https://github.com/dudko-dev/firebase-template-functions) | ||
- `firebase/hosting/api` - a web portal based on react, repo: [dudko-dev/firebase-template-website](https://github.com/dudko-dev/firebase-template-website) | ||
- `firebase/hosting/website` - web portal on js, repo: [dudko-dev/firebase-template-api](https://github.com/dudko-dev/firebase-template-api) | ||
|
||
The project allows you to quickly deploy the basic configuration of firebase, configure the basic skeleton of cloud functions, deploy a portal on react with ready-made authorization/registration/email confirmation/password recovery methods. | ||
|
||
just run a script: | ||
|
||
```bash | ||
#!/usr/bin/bash | ||
FIREBASE_REPO="dudko-dev/firebase-template" | ||
FIREBASE_REPO_DIR="." | ||
FIREBASE_FUNCTIONS_REPO="dudko-dev/firebase-template-functions" | ||
FIREBASE_FUNCTIONS_DIR="./functions" | ||
FIREBASE_WEBSITE_REPO="dudko-dev/firebase-template-website" | ||
FIREBASE_WEBSITE_DIR="./hosting/website" | ||
FIREBASE_WEBAPI_REPO="dudko-dev/firebase-template-api" | ||
FIREBASE_WEBAPI_DIR="./hosting/api" | ||
|
||
mkdir $FIREBASE_REPO_DIR | ||
git clone $FIREBASE_REPO $FIREBASE_REPO_DIR | ||
mkdir $FIREBASE_FUNCTIONS_DIR | ||
git clone $FIREBASE_FUNCTIONS_REPO $FIREBASE_FUNCTIONS_DIR | ||
mkdir $FIREBASE_WEBSITE_DIR | ||
git clone $FIREBASE_WEBSITE_REPO $FIREBASE_WEBSITE_DIR | ||
mkdir $FIREBASE_WEBAPI_DIR | ||
git clone $FIREBASE_WEBAPI_REPO $FIREBASE_WEBAPI_DIR | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"rules": { | ||
".read": false, | ||
".write": false, | ||
"users": { | ||
"$user_id": { | ||
".read": "$user_id === auth.uid", | ||
".write": false | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.