Skip to content

Fix action name in ci-cd.yml workflow #5

Fix action name in ci-cd.yml workflow

Fix action name in ci-cd.yml workflow #5

Workflow file for this run

# .github/workflows/ci-cd.yml
name: CI/CD
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
deploy:
needs: build-and-test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' # Deploy only from the main branch
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}
- name: Sync files to S3
uses: aws-actions/aws-s3-sync@v2
with:
source: './src'
destination: 's3://${{ secrets.AWS_S3_BUCKET_NAME }}'
delete: true