Lesson 10CI/CD
The final step is to create a CI/CD with github actions.
package.json
..."scripts": {..."affected:deploy": "nx affected --target=deploy",...}...
.github/workflows/actions.yml
name: Nx Affected Test & Deployon:push:branches: [main]env:BEFORE_SHA: ${{ github.event.before }}AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }}AWS_DEFAULT_REGION: 'eu-central-1'NG_DEPLOY_AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}NG_DEPLOY_AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_KEY }}NG_DEPLOY_AWS_BUCKET: 'nx-hero-app'NG_DEPLOY_AWS_REGION: 'eu-central-1'jobs:build:runs-on: ubuntu-lateststeps:- uses: actions/checkout@v2with:fetch-depth: 0- name: Use Node.js 12.xuses: actions/setup-node@v1with:node-version: 12.x- run: git fetch origin main- name: npm installrun: npm install- name: Run Affected Testshell: bashrun: npm run affected:test -- --base=$BEFORE_SHA- name: Run Affected Deployshell: bashrun: npm run affected:deploy -- --base=$BEFORE_SHA
> git rm libs/hero/data-access/src/lib/services/hero-api.service.spec.ts> git rm libs/hero/hero-list/src/lib/pages/hero-list/hero-list.component.spec.ts> git rm libs/hero/hero-list/src/lib/components/hero-viewer/hero-viewer.component.spec.ts> git rm apps/hero-app/src/app/app.component.spec.ts