Merge pull request #22 from MarceloVichar/develop #4
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 - Production - Pipeline | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
deployment: | |
runs-on: ubuntu-latest | |
env: | |
ENV: production | |
NUXT_PUBLIC_API_BASE: https://api.lets.tur.br | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_S3_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_S3_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_S3_REGION }} | |
- name: Repository Name | |
run: echo ${{ github.repository }} | |
- name: Get bucket name | |
id: get-bucket-name | |
run: echo "::set-output name=name::v2.lets.tur.br" | |
- name: S3 Search | |
id: s3-search-bucket | |
run: echo "::set-output name=code::$(aws s3 ls s3://${{ steps.get-bucket-name.outputs.name }} || echo $?)" | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 20.x | |
- name: Install dependencies | |
run: npm i | |
- name: Build | |
run: npm run generate | |
- name: S3 Sync | |
if: success() | |
run: aws s3 sync .output/public/ s3://${{ steps.get-bucket-name.outputs.name }} |