Skip to content

Commit 43334e4

Browse files
committed
feat(home): ✨ add firebase
1 parent 15b352d commit 43334e4

16 files changed

+1053
-89
lines changed

.firebaserc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"projects": {
3+
"default": "nx-angular-release"
4+
}
5+
}

.github/workflows/ci.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Publish Libraries
1+
name: LIVE - Publish Libraries & Deploy App
22
'on':
33
push:
44
branches:
@@ -26,16 +26,26 @@ jobs:
2626
else
2727
npm i
2828
fi
29-
- name: Pretty code 💄
30-
run: npx nx format:check
29+
3130
- name: Lint ♻️
32-
run: npx nx affected -t lint --all --parallel=true
31+
run: npx nx affected -t lint
32+
3333
- name: Build 📦
34-
run: npx nx affected -t build --all --parallel=true
34+
run: npx nx affected -t build
35+
3536
- name: Test 🧪
36-
run: npx nx affected -t test --all --ci --code-coverage --parallel=true
37+
run: npx nx affected -t test --ci --code-coverage
38+
3739
- name: Release 🚀
3840
env:
3941
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4042
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
4143
run: npx nx run-many --target=deploy --parallel=false
44+
45+
- name: Deploy to Firebase 🔥
46+
uses: FirebaseExtended/action-hosting-deploy@v0
47+
with:
48+
repoToken: '${{ secrets.GITHUB_TOKEN }}'
49+
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NX_ANGULAR_RELEASE }}'
50+
channelId: live
51+
projectId: nx-angular-release

.github/workflows/next.yml

Lines changed: 51 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,51 @@
1-
name: Publish Libraries
2-
'on':
3-
push:
4-
branches:
5-
- master
6-
7-
jobs:
8-
build_and_deploy:
9-
runs-on: ubuntu-latest
10-
permissions: write-all
11-
steps:
12-
- name: Checkout repo ✅
13-
uses: actions/checkout@v2
14-
with:
15-
# We need to fetch all branches and commits so that Nx affected has a base to compare against.
16-
fetch-depth: 0
17-
- name: NRWL setup ✅
18-
uses: nrwl/nx-set-shas@v3
19-
20-
- name: Install Dependencies 🔧
21-
run: |
22-
if [ -e yarn.lock ]; then
23-
yarn install --frozen-lockfile
24-
elif [ -e package-lock.json ]; then
25-
npm ci
26-
else
27-
npm i
28-
fi
29-
- name: Pretty code 💄
30-
run: npx nx format:check
31-
- name: Lint ♻️
32-
run: npx nx affected -t lint --all --parallel=true
33-
- name: Build 📦
34-
run: npx nx affected -t build --all --parallel=true
35-
- name: Test 🧪
36-
run: npx nx affected -t test --all --ci --code-coverage --parallel=true
37-
- name: Release 🚀
38-
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
41-
run: npx nx run-many --target=deploy --parallel=false
1+
name: Next - Publish Libraries & Deploy App
2+
'on':
3+
push:
4+
branches:
5+
- next
6+
7+
jobs:
8+
build_and_deploy:
9+
runs-on: ubuntu-latest
10+
permissions: write-all
11+
steps:
12+
- name: Checkout repo ✅
13+
uses: actions/checkout@v2
14+
with:
15+
# We need to fetch all branches and commits so that Nx affected has a base to compare against.
16+
fetch-depth: 0
17+
- name: NRWL setup ✅
18+
uses: nrwl/nx-set-shas@v3
19+
20+
- name: Install Dependencies 🔧
21+
run: |
22+
if [ -e yarn.lock ]; then
23+
yarn install --frozen-lockfile
24+
elif [ -e package-lock.json ]; then
25+
npm ci
26+
else
27+
npm i
28+
fi
29+
30+
- name: Lint ♻️
31+
run: npx nx affected -t lint
32+
33+
- name: Build 📦
34+
run: npx nx affected -t build
35+
36+
- name: Test 🧪
37+
run: npx nx affected -t test --ci --code-coverage
38+
39+
- name: Release 🚀
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
43+
run: npx nx run-many --target=deploy --parallel=false
44+
45+
- name: Deploy to Firebase 🔥
46+
uses: FirebaseExtended/action-hosting-deploy@v0
47+
with:
48+
repoToken: '${{ secrets.GITHUB_TOKEN }}'
49+
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_NX_ANGULAR_RELEASE }}'
50+
projectId: nx-angular-release
51+
channelId: next

.github/workflows/pr.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ jobs:
2727
else
2828
npm i
2929
fi
30-
- name: Pretty code 💄
31-
run: npx nx format:check
30+
3231
- name: Lint ♻️
3332
run: npx nx affected -t lint
3433
- name: Build 📦

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ testem.log
3939
Thumbs.db
4040

4141
.angular
42+
/.firebase

.nxreleaserc.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
{
2-
"changelog": true,
3-
"npm": true,
4-
"github": true,
52
"repositoryUrl": "https://github.com/tomavic/enigma-nx-angular",
63
"branches": ["master"]
74
}

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
/dist
33
/coverage
44
.angular
5+
/.firebase

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Enigma
1+
# Enigma - Nx. Angular. Firebase. GithubActions. Semantic Release.
22

33
<a alt="Nx logo" href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="45"></a>
44

apps/home/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@
104104
"github": true,
105105
"changelog": true,
106106
"npm": false,
107-
"tagFormat": "HomeApp-v${VERSION}"
107+
"tagFormat": "home-v${VERSION}",
108+
"commitMessage": "chore(home): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
108109
}
109110
},
110111
"serve-static": {

apps/home/src/main.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
1-
import { platformBrowserDynamic } from "@angular/platform-browser-dynamic";
2-
import { AppModule } from "./app/app.module";
1+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
2+
import { AppModule } from './app/app.module';
3+
4+
// Import the functions you need from the SDKs you need
5+
import { initializeApp } from 'firebase/app';
6+
import { getAnalytics } from 'firebase/analytics';
7+
// TODO: Add SDKs for Firebase products that you want to use
8+
// https://firebase.google.com/docs/web/setup#available-libraries
9+
10+
// Your web app's Firebase configuration
11+
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
12+
const firebaseConfig = {
13+
apiKey: 'AIzaSyBeSe1VBeBq6WSWSv1Tkd93ESfMNhHA3GI',
14+
authDomain: 'nx-app-7e3ee.firebaseapp.com',
15+
projectId: 'nx-app-7e3ee',
16+
storageBucket: 'nx-app-7e3ee.appspot.com',
17+
messagingSenderId: '253552751829',
18+
appId: '1:253552751829:web:e1baaf3a59ad97d9491e5c',
19+
measurementId: 'G-SK1RMJT02P',
20+
};
21+
22+
// Initialize Firebase
23+
const app = initializeApp(firebaseConfig);
24+
const analytics = getAnalytics(app);
325

426
platformBrowserDynamic()
527
.bootstrapModule(AppModule)

firebase.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"hosting": {
3+
"public": "dist/apps/home",
4+
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"]
5+
}
6+
}

libs/footer/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
"github": true,
5858
"changelog": true,
5959
"npm": true,
60-
"tagFormat": "footer-v${VERSION}"
60+
"tagFormat": "footer-v${VERSION}",
61+
"commitMessage": "chore(footer): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
6162
}
6263
}
6364
}

libs/header/project.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
"github": true,
5858
"changelog": true,
5959
"npm": true,
60-
"tagFormat": "header-v${VERSION}"
60+
"tagFormat": "header-v${VERSION}",
61+
"commitMessage": "chore(header): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
6162
}
6263
}
6364
}

lint-staged.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module.exports = {
22
'**/*.{ts,js,json,md,html,css,scss}': [
33
'npx nx affected -t lint --uncommitted --fix true',
4-
'npx nx format:write --uncommitted',
54
],
65
};

0 commit comments

Comments
 (0)