Skip to content

Bump @aws-sdk/client-s3 from 3.421.0 to 3.591.0 #553

Bump @aws-sdk/client-s3 from 3.421.0 to 3.591.0

Bump @aws-sdk/client-s3 from 3.421.0 to 3.591.0 #553

name: 'Build, Test & Deploy'
on:
repository_dispatch:
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- master
jobs:
test:
name: 'Build & Test'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint && npm run format-check
- name: Test
run: npm test
- name: Build
run: npm run build
- name: Package
run: npm run package
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
deploy:
concurrency:
group: prod_deploy
cancel-in-progress: false
name: 'Sync to S3'
runs-on: ubuntu-20.04
needs: test
if: github.actor != 'dependabot[bot]' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
steps:
- uses: actions/checkout@v4
- 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: us-east-1
- uses: badsyntax/github-action-aws-cloudformation@v1.0.3
name: Update CloudFormation Stack
id: update-stack
with:
stack-name: 'badsyntax-github-action-example-aws-s3'
template: './cloudformation/s3bucket-example.yml'
apply-change-set: ${{ github.event_name != 'repository_dispatch' }}
aws-region: 'us-east-1'
parameters: 'S3BucketName=badsyntax-github-action-example-aws-s3-us-east-1&S3AllowedOrigins=https://richardwillis.info'
- uses: ./
name: Sync HTML files to S3
id: sync-html-s3
with:
bucket: ${{ steps.update-stack.outputs.S3BucketName }}
action: 'sync'
src-dir: './test-fixtures'
files-glob: '**/*.html'
aws-region: 'us-east-1'
prefix: 'preview'
strip-extension-glob: '**/**.html'
cache-control: 'public,max-age=0,s-maxage=31536000,must-revalidate'
- uses: ./
name: Sync immutable files to S3
id: sync-immutable-s3
with:
bucket: ${{ steps.update-stack.outputs.S3BucketName }}
action: 'sync'
src-dir: './test-fixtures'
files-glob: '{site-assets,css,img}/**/*'
aws-region: 'us-east-1'
prefix: 'preview'
cache-control: 'public,max-age=31536000,immutable'
- name: Output Synced Files
run: |
echo "Synced HTML Files: $S3SyncedHTMLFiles"
echo "Synced Immutable Files: $S3SyncedImmutableFiles"
env:
# Use outputs from the S3 step
S3SyncedHTMLFiles: ${{ steps.sync-html-s3.outputs.modified-keys }}
S3SyncedImmutableFiles: ${{ steps.sync-immutable-s3.outputs.modified-keys }}