Skip to content

πŸ” Sync docs with S3 #20

πŸ” Sync docs with S3

πŸ” Sync docs with S3 #20

Workflow file for this run

name: πŸ” Sync docs with S3
on: workflow_dispatch
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: main
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'