Skip to content

Commit

Permalink
Merge pull request #217 from valerymelou/chore/cd
Browse files Browse the repository at this point in the history
Chore/cd
  • Loading branch information
valerymelou authored Jul 13, 2024
2 parents af258cd + 094233b commit 6ce0271
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 2 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on:
workflow_call:
inputs:
environment:
required: true
type: string
description: 'The environment to deploy to'

jobs:
deploy:
runs-on: ubuntu-latest
environment: ${{ inputs.environment }}
steps:
- uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'yarn'

- run: yarn install
- run: npx nx run website:build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: ${{ secrets.GITHUB_TOKEN }}
firebaseServiceAccount: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
channelId: live
projectId: ${{ secrets.FIREBASE_PROJECT_ID }}
18 changes: 18 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ concurrency:
permissions:
actions: read
contents: read
checks: write
pull-requests: write

jobs:
test:
Expand Down Expand Up @@ -54,3 +56,19 @@ jobs:
path: |
.nx
key: ${{ steps.nx-cache-restore.outputs.cache-primary-key }}

deploy-preview:
if: github.ref == 'refs/heads/develop'
needs: test
uses: ./.github/workflows/cd.yml
secrets: inherit
with:
environment: staging

deploy:
if: github.ref == 'refs/heads/master'
needs: test
uses: ./.github/workflows/cd.yml
secrets: inherit
with:
environment: production
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ Thumbs.db
.nx/workspace-data
.angular
.env
.firebaserc
16 changes: 16 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"hosting": {
"public": "dist/apps/website/browser",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
13 changes: 13 additions & 0 deletions libs/blog/feature-article/src/lib/blog-article.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { provideRouter } from '@angular/router';

import { BlogArticleComponent } from './blog-article.component';
import { ArticleService, Article } from '@valerymelou/blog/data-access';
import { of } from 'rxjs';

describe('BlogArticleComponent', () => {
let component: BlogArticleComponent;
Expand All @@ -8,6 +12,15 @@ describe('BlogArticleComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [BlogArticleComponent],
providers: [
provideRouter([]),
{
provide: ArticleService,
useValue: {
getOne: () => of(new Article()),
},
},
],
}).compileComponents();

fixture = TestBed.createComponent(BlogArticleComponent);
Expand Down
7 changes: 5 additions & 2 deletions libs/blog/feature-home/src/lib/blog-home.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { BlogHomeComponent } from './blog-home.component';
import { Article, ArticleService } from '@valerymelou/blob/data-access';

import { of } from 'rxjs';

import { Article, ArticleService } from '@valerymelou/blog/data-access';

import { BlogHomeComponent } from './blog-home.component';

describe('BlogHomeComponent', () => {
let component: BlogHomeComponent;
let fixture: ComponentFixture<BlogHomeComponent>;
Expand Down

0 comments on commit 6ce0271

Please sign in to comment.