Skip to content

Commit

Permalink
Deploy releases to BunnyCDN (#2466)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaharagon committed Mar 31, 2024
1 parent 139a206 commit e124ecf
Show file tree
Hide file tree
Showing 3 changed files with 249 additions and 71 deletions.
75 changes: 74 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,19 @@ on:
type: boolean
github_pages:
type: boolean
bunnycdn_production:
type: boolean
minio_production:
type: boolean
outputs:
netlify_preview_address:
value: ${{ jobs.netlify_preview.outputs.address }}
secrets:
NETLIFY_TOKEN:
PROD_BUNNYCDN_API_KEY:
PROD_BUNNYCDN_PASSWORD:
PROD_MINIO_KEY_ID:
PROD_MINIO_SECRET_KEY:

jobs:
netlify_preview:
Expand Down Expand Up @@ -90,7 +98,7 @@ jobs:

environment:
name: production
url: https://www.privacyguides.org
url: https://illustrious-bavarois-56cf30.netlify.app/

steps:
- uses: actions/download-artifact@v4
Expand Down Expand Up @@ -165,3 +173,68 @@ jobs:

- id: deployment
uses: actions/deploy-pages@main

bunnycdn_production:
if: inputs.bunnycdn_production
runs-on: ubuntu-latest

permissions:
contents: read

environment:
name: production
url: https://privacyguides-org-production.b-cdn.net

steps:
- uses: actions/download-artifact@v4
with:
pattern: site-build-*
merge-multiple: true

- run: |
for file in *.tar.gz; do tar -zxf "$file"; done
ls -la site/
- uses: own3d/bunny-action@bfaa5c6bc8b7a7ebd599ddd4912347d7c3847e78
env:
BUNNY_API_ACCESS_KEY: ${{ secrets.PROD_BUNNYCDN_API_KEY }}
BUNNY_STORAGE_HOSTNAME: storage.bunnycdn.com
BUNNY_STORAGE_USERNAME: ${{ vars.PROD_BUNNYCDN_USER }}
BUNNY_STORAGE_PASSWORD: ${{ secrets.PROD_BUNNYCDN_PASSWORD }}
BUNNY_PULL_ZONE_ID: 2117106
with:
server: "storage.bunnycdn.com"
username: ${{ vars.PROD_BUNNYCDN_USER }}
password: ${{ secrets.PROD_BUNNYCDN_PASSWORD }}
local-dir: ./site/

minio_production:
if: inputs.minio_production
runs-on: ubuntu-latest

permissions:
contents: read

environment:
name: production
url: https://privacyguides-org-production.stor1-minio.jonaharagon.net

steps:
- uses: actions/download-artifact@v4
with:
pattern: site-build-*
merge-multiple: true

- run: |
for file in *.tar.gz; do tar -zxf "$file"; done
ls -la site/
- uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete
env:
SOURCE_DIR: "site/"
AWS_S3_BUCKET: ${{ vars.PROD_MINIO_BUCKET }}
AWS_S3_ENDPOINT: ${{ vars.PROD_MINIO_HOSTNAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.PROD_MINIO_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.PROD_MINIO_SECRET_KEY }}
6 changes: 6 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,14 @@ jobs:
with:
netlify_production: true
github_pages: true
bunnycdn_production: true
minio_production: true
secrets:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
PROD_BUNNYCDN_API_KEY: ${{ secrets.PROD_BUNNYCDN_API_KEY }}
PROD_BUNNYCDN_PASSWORD: ${{ secrets.PROD_BUNNYCDN_PASSWORD }}
PROD_MINIO_KEY_ID: ${{ secrets.PROD_MINIO_KEY_ID }}
PROD_MINIO_SECRET_KEY: ${{ secrets.PROD_MINIO_SECRET_KEY }}

cleanup:
if: ${{ always() }}
Expand Down
Loading

0 comments on commit e124ecf

Please sign in to comment.