Skip to content

🚒 Production Pipeline #2

🚒 Production Pipeline

🚒 Production Pipeline #2

Workflow file for this run

name: 🚒 Production Pipeline
run-name: 🚒 Production Pipeline
on:
push:
branches:
- main
env:
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
jobs:
lint:
name: πŸͺ„ Lint
runs-on: ubuntu-latest
steps:
- name: 🚫 Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.12.1
- name: ⬇️ Check out repository code
uses: actions/checkout@v4.1.1
- name: 🟩 Set up Node
uses: actions/setup-node@v4.0.2
with:
node-version: "16"
cache: "npm"
- name: πŸ“₯ Download dependencies
run: npm ci
- name: πŸ”¬ Lint source code
run: npm run lint
typecheck:
name: πŸͺ„ Typecheck
runs-on: ubuntu-latest
steps:
- name: 🚫 Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.12.1
- name: ⬇️ Check out repository code
uses: actions/checkout@v4.1.1
- name: 🟩 Set up Node
uses: actions/setup-node@v4.0.2
with:
node-version: "16"
cache: "npm"
- name: πŸ“₯ Download dependencies
run: npm ci
- name: βœ… Typecheck
run: npm run typecheck
test:
name: πŸ§ͺ Test
needs: [lint, typecheck]
runs-on: ubuntu-latest
steps:
- name: 🚫 Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.12.1
- name: ⬇️ Check out repository code
uses: actions/checkout@v4.1.1
- name: 🟩 Set up Node
uses: actions/setup-node@v4.0.2
with:
node-version: "16"
cache: "npm"
- name: πŸ“₯ Download dependencies
run: npm ci
- name: πŸ§ͺ Run tests
run: npm test -- --coverage
- name: πŸ“Š Upload test coverage folder as an artifact
uses: actions/upload-artifact@v4.3.1
with:
name: coverage
path: ./coverage
build:
name: πŸ“¦ Build
needs: [test]
runs-on: ubuntu-latest
steps:
- name: 🚫 Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.12.1
- name: ⬇️ Check out repository code
uses: actions/checkout@v4.1.1
- name: 🟩 Set up Node
uses: actions/setup-node@v4.0.2
with:
node-version: "16"
cache: "npm"
- name: πŸ“₯ Download dependencies
run: npm ci
- name: πŸ—οΈ Build App
run: npm run build
- name: ⬆️ Upload production build as an artifact
uses: actions/upload-artifact@v4.3.1
with:
name: build
path: ./build
deploy:
name: 🚒 Deploy to Production
needs: [build]
runs-on: ubuntu-latest
steps:
- name: 🚫 Cancel Workflow Action
uses: styfle/cancel-workflow-action@0.12.1
- name: ⬇️ Check out repository code
uses: actions/checkout@v4.1.1
- name: 🟩 Set up Node
uses: actions/setup-node@v4.0.2
with:
node-version: "16"
cache: "npm"
- name: πŸ“₯ Download dependencies
run: npm ci
- name: ⬇️ Download production build artifact
uses: actions/download-artifact@v4.1.4
- name: πŸ‘€ Display structure of build directory
run: ls -l
working-directory: build
- name: πŸ‘€ Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4.0.2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: 🚒 Deploy (Sync build folder to the production bucket with the AWS CLI)
run: |
aws s3 sync ./build s3://$AWS_S3_BUCKET_NAME