add: 고객용 deploy.yml 템플릿
This commit is contained in:
47
template/.gitea/workflows/deploy.yml
Normal file
47
template/.gitea/workflows/deploy.yml
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
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"
|
||||||
Reference in New Issue
Block a user