From 7349ff07fbfded6526f5295af3e2fd3b649ab8fe Mon Sep 17 00:00:00 2001 From: Erin Geier <115035002+emgeier@users.noreply.github.com> Date: Thu, 17 Oct 2024 11:53:20 -0500 Subject: [PATCH] Update main.yml This is an updated actions workflow file for deploying the frontend files to an s3 bucket for static website hosting. --- .github/workflows/main.yml | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ba8439c..4e591a2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,25 +1,22 @@ -name: ci +name: Deploy to S3 on: push: branches: - - 'build' + - 'staticSite' # Trigger the workflow on push to the branch permissions: - id-token: write # This is required for requesting the JWT - contents: read # This is required for actions/checkout + id-token: write + contents: read jobs: - init: + deploy: runs-on: ubuntu-latest steps: + # Step 1: Check out the repository code - uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'temurin' + # Step 2: Configure AWS credentials - name: Configure AWS credentials from AWS account uses: aws-actions/configure-aws-credentials@v2 with: @@ -27,12 +24,10 @@ jobs: aws-region: ${{ secrets.AWS_REGION }} role-session-name: GitHub-OIDC-frontend - - name: Run script to change files, build docker and push to ECR + # Step 3: Sync files to S3 for static website hosting + - name: Sync files to S3 run: | - build/workflow.sh + aws s3 sync ./ s3://srophe-syriaca-front-end --delete env: - SECRET_KEY: ${{ secrets.SECRET_KEY }} - ADMIN_PASSWORD: ${{secrets.ADMIN_PASSWORD}} - ECR_REPOSITORY: ${{secrets.ECR_REPOSITORY}} - AWS_REGION: ${{ secrets.AWS_REGION }} - AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}