From f136b38d188e36b4259d8754e7cc705353e7b9f4 Mon Sep 17 00:00:00 2001 From: Franco Lugo <102172862+Peco1503@users.noreply.github.com> Date: Sun, 9 Jun 2024 19:06:33 -0600 Subject: [PATCH] Create main.yml for CI/CD with GitHub actions --- .github/workflows/main.yml | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..2d894e5 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,43 @@ +name: Deploy to AWS Amplify + +on: + push: + branches: + - main + paths-ignore: + - '**.md' + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install dependencies + run: npm ci + + - name: Build + run: npm run build + + - name: Install AWS Amplify CLI + run: npm install -g @aws-amplify/cli + + - name: Initialize Amplify + run: | + amplify init --amplify "{ \"envName\": \"prod\" }" --yes + env: + 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 Amplify + run: amplify publish + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}