user can review booked accommodation (#64) #44
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
name: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
env: | |
VITE_GOOGLE_MAPS_API_KEY: ${{ secrets.VITE_GOOGLE_MAPS_API_KEY }} | |
VITE_API_URL: ${{ secrets.VITE_API_URL }} | |
strategy: | |
matrix: | |
node-version: ['22.x'] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Install Dependencies | |
run: npm ci | |
- name: Run Lint | |
run: npm run lint | |
- name: Build Project | |
run: npm run build | |
- name: Upload Build Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-artifacts | |
path: ./dist | |
cd: | |
runs-on: ubuntu-latest | |
needs: ci | |
steps: | |
- name: Download Build Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build-artifacts | |
- 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: us-east-1 | |
- name: Deploy to S3 | |
run: aws s3 sync . s3://${{ secrets.AWS_S3_BUCKET_NAME }} --delete | |
- name: Invalidate CloudFront Cache | |
run: | | |
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*" |