Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/cd #217

Merged
merged 5 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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