-
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
1 parent
3b5a09c
commit 5d750e9
Showing
1 changed file
with
107 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,107 @@ | ||
name: Portfolio CI/CD Pipeline | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
env: | ||
SERVER: production | ||
APP_NAME: portfolio | ||
ENV: prod | ||
|
||
jobs: | ||
build-test-api: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./apps/api | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.16.x | ||
cache: npm | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run linting | ||
run: npm run lint | ||
|
||
- name: Run unit tests | ||
run: npm run test | ||
|
||
- name: Build artifact | ||
run: npm run build | ||
|
||
- name: Publish artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: api-build | ||
path: .webpack/service | ||
|
||
build-test-website: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./apps/website | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.16.x | ||
cache: npm | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Run linting | ||
run: npm run lint | ||
|
||
- name: Run unit tests | ||
run: npm run test | ||
|
||
- name: Build artifact | ||
run: npm run build | ||
|
||
- name: Publish artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: website-build | ||
path: ./build | ||
|
||
deploy: | ||
runs-on: ubuntu-latest | ||
needs: [build-test-api, build-test-website] | ||
defaults: | ||
run: | ||
working-directory: ./infrastructure | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: ../artifacts | ||
|
||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.16.x | ||
cache: npm | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Pulumi preview | ||
run: pulumi preview -s ${{env.APP_NAME}}-${{env.ENV}} --non-interactive | ||
|
||
- name: Pulumi up | ||
run: pulumi up -s ${{env.APP_NAME}}-${{env.ENV}} --yes --non-interactive |