From 9b825811bedb6b7c16070a94c110f20a9e718d97 Mon Sep 17 00:00:00 2001 From: Jacob Marks <100745682+J8k3@users.noreply.github.com> Date: Tue, 12 May 2026 14:30:08 -0400 Subject: [PATCH] Add GitHub Actions workflow for S3 deployment --- .github/workflows/deploy.yml | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..1efff0c4 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,50 @@ +name: Deploy to S3 +on: + workflow_run: + workflows: ["Master Build, Test & Deploy"] + types: + - completed + branches: + - master + workflow_dispatch: + +permissions: + contents: read + actions: read + +jobs: + deploy: + if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} + runs-on: ubuntu-latest + steps: + - name: Download build artifact + uses: actions/download-artifact@v4 + with: + name: zipped-build + run-id: ${{ github.event.workflow_run.id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + path: artifact + + - name: Unzip build + run: unzip artifact/*.zip -d build + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + 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 to S3 + run: | + aws s3 sync build/ s3://cyberchef.jacobmarks.com \ + --delete \ + --cache-control "max-age=86400" + + - name: Invalidate CloudFront + run: | + aws cloudfront create-invalidation \ + --distribution-id $(aws cloudfront list-distributions \ + --query "DistributionList.Items[?DomainName=='d2p98dntmnwbcj.cloudfront.net'].Id" \ + --output text) \ + --paths "/*"