Skip to content

Commit

Permalink
v1
Browse files Browse the repository at this point in the history
  • Loading branch information
siarheidudko committed Dec 29, 2023
0 parents commit 7a942aa
Show file tree
Hide file tree
Showing 69 changed files with 13,097 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .editorconfig
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
19 changes: 19 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
REACT_APP_FIREBASE_API_KEY=AIzaSyBG8zmCabAzPWv1pmHwCWL8n7YG7oMnd1k
REACT_APP_FIREBASE_AUTH_DOMAIN=fir-template-40a59.firebaseapp.com
REACT_APP_FIREBASE_DATABASE_URL=https://fir-template-40a59-default-rtdb.firebaseio.com
REACT_APP_FIREBASE_PROJECT_ID=fir-template-40a59
REACT_APP_FIREBASE_STORAGE_BUCKET=fir-template-40a59.appspot.com
REACT_APP_FIREBASE_MESSAGING_SENDER_ID=531787831336
REACT_APP_FIREBASE_APP_ID=1:531787831336:web:37e18fb9344bec5e30bd1d
REACT_APP_FIREBASE_MEASUREMENT_ID=G-HG23ZG89NC
REACT_APP_URL=https://fir-template-website.web.app
REACT_APP_API_URL=https://fir-template-api.web.app
REACT_APP_API_VERSION=v1
REACT_APP_VERSION=${npm_package_version}
REACT_APP_NAME="Firebase Template Portal"
REACT_APP_DESCRIPTION="Firebase Template"
REACT_APP_GTAG="G-XXXXXXXXXX"
REACT_APP_AUTH_SIGNIN="/__/auth/signin"
REACT_APP_AUTH_SIGNUP="/__/auth/signup"
REACT_APP_AUTH_ACTION="/__/auth/action"
REACT_APP_404="/__/404"
19 changes: 19 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
REACT_APP_FIREBASE_API_KEY=AIzaSyBG8zmCabAzPWv1pmHwCWL8n7YG7oMnd1k
REACT_APP_FIREBASE_AUTH_DOMAIN=fir-template-40a59.firebaseapp.com
REACT_APP_FIREBASE_DATABASE_URL=https://fir-template-40a59-default-rtdb.firebaseio.com
REACT_APP_FIREBASE_PROJECT_ID=fir-template-40a59
REACT_APP_FIREBASE_STORAGE_BUCKET=fir-template-40a59.appspot.com
REACT_APP_FIREBASE_MESSAGING_SENDER_ID=531787831336
REACT_APP_FIREBASE_APP_ID=1:531787831336:web:37e18fb9344bec5e30bd1d
REACT_APP_FIREBASE_MEASUREMENT_ID=G-HG23ZG89NC
REACT_APP_URL=https://fir-template-website.web.app
REACT_APP_API_URL=https://fir-template-api.web.app
REACT_APP_API_VERSION=v1
REACT_APP_VERSION=${npm_package_version}
REACT_APP_NAME="Firebase Template Portal"
REACT_APP_DESCRIPTION="Firebase Template"
REACT_APP_GTAG="G-XXXXXXXXXX"
REACT_APP_AUTH_SIGNIN="/__/auth/signin"
REACT_APP_AUTH_SIGNUP="/__/auth/signup"
REACT_APP_AUTH_ACTION="/__/auth/action"
REACT_APP_404="/__/404"
120 changes: 120 additions & 0 deletions .github/workflows/deploy-development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: Deploy (API) to firebase
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_PARENT_REPO: "dudko-dev/firebase-template"
FIREBASE_PARENT_BRANCH: "dev"
FIREBASE_CHILD_REPO: "dudko-dev/firebase-template-functions"
FIREBASE_CHILD_BRANCH: "dev"
SITE_DIR: "website"
FIREBASE_SITE_ALIAS: "website"
jobs:
deploy:
name: Deploy site to firebase
runs-on: ubuntu-latest
env:
ENVKEY: ${{ secrets.ENVKEY }}
timeout-minutes: 10
steps:
- name: Сheckout firebase repo (${{ env.FIREBASE_PARENT_REPO }})
uses: actions/checkout@v4
with:
repository: ${{ env.FIREBASE_PARENT_REPO }}
ref: refs/heads/${{ env.FIREBASE_PARENT_BRANCH }}
token: ${{ env.TOKEN_FOR_WORKFLOW }}
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: Make hosting directory
run: |
if [[ ! -d firebase/hosting ]]; then
mkdir firebase/hosting;
fi
- name: Сheckout site repo (${{ github.repository }})
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
ref: ${{ github.ref }}
path: "firebase/hosting/${{ env.SITE_DIR }}"
- name: Change mode directory
run: chmod 0755 -R firebase
working-directory: ${{ github.workspace }}
- name: Install node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.yarn
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install build dependencies
run: sudo npm install firebase-tools yarn -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/hosting/${{ env.SITE_DIR }}
- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: ${{ github.workspace }}/firebase/hosting/${{ env.SITE_DIR }}
- name: Remove production config
if: ${{ env.FIREBASE_PROJECT != 'production' }}
run: rm -f ./.env.production
working-directory: ${{ github.workspace }}/firebase/hosting/${{ env.SITE_DIR }}
- name: Copy config to production
if: ${{ env.FIREBASE_PROJECT != 'production' }}
run: cp ./.env.$FIREBASE_PROJECT ./.env.production
working-directory: ${{ github.workspace }}/firebase/hosting/${{ env.SITE_DIR }}
- name: Build app
run: yarn build
working-directory: ${{ github.workspace }}/firebase/hosting/${{ env.SITE_DIR }}
- name: Deploy to firebase
run: firebase deploy -m "Autodeploy from GitHUB ($GITHUB_ACTOR)" --only hosting:$FIREBASE_SITE_ALIAS
working-directory: ${{ github.workspace }}/firebase/hosting/${{ env.SITE_DIR }}
- 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 }}-site-${{ env.FIREBASE_SITE_ALIAS }}-debug
path: |
${{ github.workspace }}/firebase.tar.gz
${{ github.workspace }}/npm-logs.tar.gz
retention-days: 1
120 changes: 120 additions & 0 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: Deploy site (API) to firebase
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_PARENT_REPO: "dudko-dev/firebase-template"
FIREBASE_PARENT_BRANCH: "main"
FIREBASE_CHILD_REPO: "dudko-dev/firebase-template-functions"
FIREBASE_CHILD_BRANCH: "main"
SITE_DIR: "website"
FIREBASE_SITE_ALIAS: "website"
jobs:
deploy:
name: Deploy site to firebase
runs-on: ubuntu-latest
env:
ENVKEY: ${{ secrets.ENVKEY }}
timeout-minutes: 10
steps:
- name: Сheckout firebase repo (${{ env.FIREBASE_PARENT_REPO }})
uses: actions/checkout@v4
with:
repository: ${{ env.FIREBASE_PARENT_REPO }}
ref: refs/heads/${{ env.FIREBASE_PARENT_BRANCH }}
token: ${{ env.TOKEN_FOR_WORKFLOW }}
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: Make hosting directory
run: |
if [[ ! -d firebase/hosting ]]; then
mkdir firebase/hosting;
fi
- name: Сheckout site repo (${{ github.repository }})
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
ref: ${{ github.ref }}
path: "firebase/hosting/${{ env.SITE_DIR }}"
- name: Change mode directory
run: chmod 0755 -R firebase
working-directory: ${{ github.workspace }}
- name: Install node
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.yarn
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install build dependencies
run: sudo npm install firebase-tools yarn -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/hosting/${{ env.SITE_DIR }}
- name: Install dependencies
run: yarn install --frozen-lockfile
working-directory: ${{ github.workspace }}/firebase/hosting/${{ env.SITE_DIR }}
- name: Remove production config
if: ${{ env.FIREBASE_PROJECT != 'production' }}
run: rm -f ./.env.production
working-directory: ${{ github.workspace }}/firebase/hosting/${{ env.SITE_DIR }}
- name: Copy config to production
if: ${{ env.FIREBASE_PROJECT != 'production' }}
run: cp ./.env.$FIREBASE_PROJECT ./.env.production
working-directory: ${{ github.workspace }}/firebase/hosting/${{ env.SITE_DIR }}
- name: Build app
run: yarn build
working-directory: ${{ github.workspace }}/firebase/hosting/${{ env.SITE_DIR }}
- name: Deploy to firebase
run: firebase deploy -m "Autodeploy from GitHUB ($GITHUB_ACTOR)" --only hosting:$FIREBASE_SITE_ALIAS
working-directory: ${{ github.workspace }}/firebase/hosting/${{ env.SITE_DIR }}
- 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 }}-site-${{ env.FIREBASE_SITE_ALIAS }}-debug
path: |
${{ github.workspace }}/firebase.tar.gz
${{ github.workspace }}/npm-logs.tar.gz
retention-days: 1
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
61 changes: 61 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"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
}
],
"[typescriptreact]": {
"editor.defaultFormatter": "vscode.typescript-language-features",
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.autoIndent": "full",
"editor.folding": true,
"editor.renderWhitespace": "all"
},
"[css]": {
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.autoIndent": "full",
"editor.folding": true,
"editor.renderWhitespace": "all",
"editor.defaultFormatter": "vscode.css-language-features"
},
"[html]": {
"editor.insertSpaces": true,
"editor.tabSize": 2,
"editor.autoIndent": "full",
"editor.folding": true,
"editor.renderWhitespace": "all"
},
"files.associations": {
"*.json": "jsonc",
"*.jsx": "typescript",
"*.tsx": "typescriptreact"
}
}
Loading

0 comments on commit 7a942aa

Please sign in to comment.