Fix S3 upload by using s3api put-object instead of s3 cp (#978)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: thomasnordquist <7721625+thomasnordquist@users.noreply.github.com>
This commit is contained in:
Copilot
2025-12-23 14:26:12 +01:00
committed by GitHub
parent 73c48f388b
commit 0d34f86893
2 changed files with 6 additions and 3 deletions

View File

@@ -92,7 +92,10 @@ jobs:
AWS_BUCKET: ${{ vars.AWS_BUCKET }} AWS_BUCKET: ${{ vars.AWS_BUCKET }}
FILENAME: ${{ steps.filename.outputs.filename }} FILENAME: ${{ steps.filename.outputs.filename }}
run: | run: |
aws s3 cp ./ui-test.gif s3://${AWS_BUCKET}/${FILENAME} \ aws s3api put-object \
--bucket ${AWS_BUCKET} \
--key ${FILENAME} \
--body ./ui-test.gif \
--tagging "expiration=90days&Source=github-actions&Type=pr-demo-video" \ --tagging "expiration=90days&Source=github-actions&Type=pr-demo-video" \
--acl public-read --acl public-read
- name: Generate file URL - name: Generate file URL

View File

@@ -262,7 +262,7 @@ aws s3api get-bucket-lifecycle-configuration --bucket YOUR_BUCKET_NAME
- `Source=github-actions` - Identifies source of upload - `Source=github-actions` - Identifies source of upload
- `Type=pr-demo-video` - Categorizes the object type - `Type=pr-demo-video` - Categorizes the object type
- **S3 lifecycle rule**: Automatically deletes objects tagged with `expiration=90days` after 90 days - **S3 lifecycle rule**: Automatically deletes objects tagged with `expiration=90days` after 90 days
- **Upload mechanism**: AWS CLI is installed via Python pip, authentication is configured via `aws-actions/configure-aws-credentials@v4` GitHub Action, then `aws s3 cp` is used with object tagging support - **Upload mechanism**: AWS CLI v2 is installed directly, authentication is configured via `aws-actions/configure-aws-credentials@v4` GitHub Action, then `aws s3api put-object` is used with object tagging support
- **gh-pages video**: `video.mp4` in gh-pages branch is served from GitHub Pages, not S3, so it persists indefinitely - **gh-pages video**: `video.mp4` in gh-pages branch is served from GitHub Pages, not S3, so it persists indefinitely
#### Required AWS Credentials #### Required AWS Credentials
@@ -278,7 +278,7 @@ The S3 bucket must have:
- Object tagging enabled - Object tagging enabled
- Lifecycle policy configured as described above - Lifecycle policy configured as described above
The workflow uses AWS CLI installed via Python pip and `aws-actions/configure-aws-credentials@v4` action for secure credential management. The workflow uses AWS CLI v2 installed directly and `aws-actions/configure-aws-credentials@v4` action for secure credential management.
## Troubleshooting ## Troubleshooting