-
-
Notifications
You must be signed in to change notification settings - Fork 1
54 lines (46 loc) · 1.39 KB
/
sync-s3-posts.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: 🔁 Sync docs with S3
on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: docs
fetch-depth: 0
- name: 🛡️ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: 📦 Install dependencies
run: npm ci
- name: ⚡ Generate docs metadata
run: npm run generate:metadata
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_OWNER: ${{ github.repository_owner }}
GITHUB_REPO: ${{ github.event.repository.name}}
- name: 🏁 Check for changes
id: git-check
run: |
if [ -z "$(git diff HEAD^ HEAD -- posts/)" ]; then
echo "No changes detected."
echo "changes=false" >> "$GITHUB_ENV"
else
echo "Changes detected."
echo "changes=true" >> "$GITHUB_ENV"
fi
- name: 🪣 Sync to S3
if: env.changes == 'true'
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'eu-north-1'
SOURCE_DIR: 'posts'
DEST_DIR: 'posts'