Files
cf-multisite/template/.gitea/workflows/deploy.yml
kaffa 903348fb96
All checks were successful
TypeScript CI / build (push) Successful in 46s
Deploy to R2 / deploy (push) Successful in 1m31s
add: 고객용 deploy.yml 템플릿
2026-03-28 06:47:55 +00:00

48 lines
1.4 KiB
YAML

name: Deploy to R2
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install rclone
run: curl -s https://rclone.org/install.sh | sudo bash
- name: Deploy to R2
env:
R2_ACCESS_KEY: ${{ secrets.R2_ACCESS_KEY }}
R2_SECRET_KEY: ${{ secrets.R2_SECRET_KEY }}
R2_ENDPOINT: ${{ secrets.R2_ENDPOINT }}
R2_BUCKET: multisite-bucket
run: |
CUSTOMER_ID="${GITHUB_REPOSITORY##*/}"
SOURCE_DIR="."
if [ -d "public" ]; then SOURCE_DIR="public"; fi
mkdir -p ~/.config/rclone
cat > ~/.config/rclone/rclone.conf << EOF2
[r2]
type = s3
provider = Cloudflare
access_key_id = ${R2_ACCESS_KEY}
secret_access_key = ${R2_SECRET_KEY}
endpoint = ${R2_ENDPOINT}
acl = private
no_check_bucket = true
EOF2
echo "Deploying $CUSTOMER_ID from $SOURCE_DIR"
rclone sync "$SOURCE_DIR" "r2:${R2_BUCKET}/sites/${CUSTOMER_ID}/" \
--exclude ".git/**" --exclude ".gitea/**" \
--exclude "*.md" --exclude "README*" \
--exclude ".rebuild" --exclude ".gitignore" --exclude "LICENSE" \
-v
echo "Deployed to: https://${CUSTOMER_ID}.actions.it.com"