Merge pull request #252 from wdporter/main #9
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy to BunnyCDN Storage | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| concurrency: | |
| group: bunny-deploy | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install lftp | |
| run: sudo apt-get update && sudo apt-get install -y lftp | |
| - name: Upload to Bunny Storage (SFTP) | |
| env: | |
| BUNNY_SFTP_HOST: storage.bunnycdn.com | |
| BUNNY_SFTP_USER: ${{ secrets.BUNNY_SFTP_USER }} # Storage Zone name | |
| BUNNY_SFTP_PASS: ${{ secrets.BUNNY_SFTP_PASS }} # Storage Zone FTP/SFTP password | |
| LOCAL_DIR: . # change to 'public' or 'dist' if needed | |
| REMOTE_DIR: / # Storage Zone root | |
| run: | | |
| lftp -u "$BUNNY_SFTP_USER","$BUNNY_SFTP_PASS" sftp://"$BUNNY_SFTP_HOST" <<EOF | |
| set cmd:fail-exit true | |
| set sftp:auto-confirm yes | |
| set net:max-retries 2 | |
| set net:timeout 20 | |
| set net:reconnect-interval-base 5 | |
| lcd $LOCAL_DIR | |
| cd $REMOTE_DIR | |
| mirror --reverse --only-newer --continue --parallel=4 --verbose --delete \ | |
| --exclude-glob ".git/**" \ | |
| --exclude-glob ".github/**" \ | |
| --exclude-glob ".DS_Store" \ | |
| --exclude-glob ".gitignore" \ | |
| . | |
| bye | |
| EOF | |
| - name: Purge Bunny Pull Zone cache | |
| if: ${{ github.event_name == 'push' }} | |
| env: | |
| BUNNY_API_KEY: ${{ secrets.BUNNY_API_KEY }} | |
| BUNNY_PULLZONE_ID: ${{ secrets.BUNNY_PULLZONE_ID }} | |
| run: | | |
| curl -sS -X POST -H "AccessKey: $BUNNY_API_KEY" \ | |
| https://api.bunny.net/pullzone/$BUNNY_PULLZONE_ID/purgeCache |