Skip to content

Merge pull request #83 from aligent/hotfix/Add-Inputs-S3-Upload #2

Merge pull request #83 from aligent/hotfix/Add-Inputs-S3-Upload

Merge pull request #83 from aligent/hotfix/Add-Inputs-S3-Upload #2

Workflow file for this run

name: S3 Deployment

Check failure on line 1 in .github/workflows/s3-deploy.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/s3-deploy.yml

Invalid workflow file

(Line: 46, Col: 9): Unexpected value 'type'
on:
workflow_call:
inputs:
aws-region:
description: "AWS region"
type: string
required: false
default: "ap-southeast-2"
s3-bucket:
description: "Name of the S3 bucket"
type: string
required: true
s3-path:
description: "Path in the S3 bucket"
type: string
required: false
default: ""
local-path:
description: "Path to deploy"
type: string
required: true
default: ""
delete-flag:
description: "Enable --delete flag"
type: boolean
required: false
default: true
cache-control:
description: "Cache control headers"
type: string
required: false
extra-args:
description: "Additional AWS CLI args"
type: string
required: false
default: ""
aws-access-key-id:
description: "AWS Access Key ID"
type: string
required: true
secrets:
aws-secret-access-key:
description: "AWS Secret Access Key"
type: string
required: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS creds
uses: aws-actions/configure-aws-credentials@latest
with:
aws-access-key-id: ${{ inputs.aws-access-key-id }}
aws-secret-access-key: ${{ secrets.aws-secret-access-key }}
aws-region: ${{ inputs.aws-region }}
- name: Deploy to S3
run: |
s3_path=""
cache_control=""
extra_args=""
if [ -n "${{inputs.cache-control}}" ]; then
cache_control="--cache-control \"${{inputs.cache-control}}\""
fi
command="aws s3 sync ${{inputs.local-path}} s3://${{inputs.s3-bucket}}${{inputs.s3-path}} ${cache_control} ${{inputs.extra-args}}"
if [ "${{inputs.delete-flag}}" = "true" ]; then
command="$command --delete"
fi
$command