Skip to content

Commit 0d6b6d8

Browse files
committed
update s3 sync action
1 parent 381c996 commit 0d6b6d8

2 files changed

Lines changed: 42 additions & 5 deletions

File tree

.github/actions/aws-s3-sync/action.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ inputs:
2525
runs:
2626
using: composite
2727
steps:
28-
- name: Checkout repository
29-
uses: actions/checkout@v3
30-
3128
- name: Configure AWS credentials
3229
uses: aws-actions/configure-aws-credentials@v2
3330
with:

examples/actions/aws-s3-sync.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ jobs:
2121
sync:
2222
runs-on: ubuntu-latest
2323
steps:
24+
- name: Checkout code (if needed)
25+
uses: actions/checkout@v4
26+
2427
- name: Upload to S3
2528
uses: "Mad-Pixels/github-workflows/.github/actions/aws-s3-sync@main"
2629
with:
@@ -32,11 +35,48 @@ jobs:
3235
bucket_prefix: static/
3336
```
3437
38+
```yaml
39+
jobs:
40+
build:
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Checkout
44+
uses: actions/checkout@v4
45+
46+
- name: Build site
47+
run: npm run build
48+
49+
- name: Upload artifacts
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: build-files
53+
path: dist/
54+
55+
deploy:
56+
needs: build
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: Download artifacts
60+
uses: actions/download-artifact@v4
61+
with:
62+
name: build-files
63+
path: build-output
64+
65+
- name: Upload to S3
66+
uses: "Mad-Pixels/github-workflows/.github/actions/aws-s3-sync@main"
67+
with:
68+
aws_access_key: ${{ secrets.AWS_ACCESS_KEY }}
69+
aws_secret_key: ${{ secrets.AWS_SECRET_KEY }}
70+
aws_region: ${{ secrets.AWS_REGION }}
71+
bucket_name: ${{ secrets.BUCKET_NAME }}
72+
source_dir: "build-output"
73+
```
74+
3575
## 📥 Inputs
3676
| **Name** | **Required** | **Description** |
3777
|-------------------------|--------------|--------------------------------------------|
38-
| `aws_access_key_id` | ✅ Yes | AWS access key ID |
39-
| `aws_secret_access_key` | ✅ Yes | AWS secret access key |
78+
| `aws_access_key` | ✅ Yes | AWS access key ID |
79+
| `aws_secret_key` | ✅ Yes | AWS secret access key |
4080
| `aws_region` | ✅ Yes | AWS region (e.g. us-east-1) |
4181
| `bucket_name` | ✅ Yes | Name of the S3 bucket |
4282
| `source_dir` | ✅ Yes | Local directory to sync |

0 commit comments

Comments
 (0)