ci: deploy the showcase site to bunny cdn
7111c7f parent: 3a8a782 added
.rickub/workflows/deploy-site.yml +56 -0 | new file mode 100644 | ||
| @@ -0,0 +1,56 @@ | ||
| 1 | +# Builds the showcase site (site/) and uploads it to Bunny CDN, served as https://skilly.eventuallycoding.com. | |
| 2 | +# Only runs when the site, the screenshots or the favicon it uses, or this file change. | |
| 3 | +# | |
| 4 | +# The build has no dependencies (plain node), so there is no install step and ubuntu-latest is enough. | |
| 5 | +# | |
| 6 | +# Repository settings: secrets BUNNY_ACCESS_KEY and BUNNY_STORAGE_ZONE_PASSWORD, variables | |
| 7 | +# BUNNY_STORAGE_ZONE (storage zone name) and BUNNY_PULL_ZONE_ID (pull zone purged after the upload). | |
| 8 | +name: Deploy site | |
| 9 | + | |
| 10 | +on: | |
| 11 | + push: | |
| 12 | + branches: ["main"] | |
| 13 | + paths: | |
| 14 | + - "site/**" | |
| 15 | + - "media/screenshots/**" | |
| 16 | + - "packages/ui/public/favicon.svg" | |
| 17 | + - ".rickub/workflows/deploy-site.yml" | |
| 18 | + workflow_dispatch: | |
| 19 | + | |
| 20 | +# Workflow level: rickub ignores job-level concurrency. Deployments queue, none is cancelled | |
| 21 | +concurrency: | |
| 22 | + group: deploy-site | |
| 23 | + cancel-in-progress: false | |
| 24 | + | |
| 25 | +jobs: | |
| 26 | + deploy: | |
| 27 | + runs-on: ubuntu-latest | |
| 28 | + | |
| 29 | + steps: | |
| 30 | + - name: Checkout code | |
| 31 | + uses: actions/checkout@v4 | |
| 32 | + | |
| 33 | + - name: Setup Node.js | |
| 34 | + uses: actions/setup-node@v4 | |
| 35 | + with: | |
| 36 | + node-version: '22' | |
| 37 | + | |
| 38 | + - name: Build site | |
| 39 | + run: node site/build.mjs | |
| 40 | + | |
| 41 | + # enable-delete-action removes from the storage zone every file absent from site/dist | |
| 42 | + - name: Deploy to Bunny CDN | |
| 43 | + uses: R-J-dev/bunny-deploy@v2.1.1 | |
| 44 | + with: | |
| 45 | + access-key: ${{ secrets.BUNNY_ACCESS_KEY }} | |
| 46 | + directory-to-upload: "site/dist" | |
| 47 | + storage-endpoint: "https://storage.bunnycdn.com" | |
| 48 | + storage-zone-name: ${{ vars.BUNNY_STORAGE_ZONE }} | |
| 49 | + storage-zone-password: ${{ secrets.BUNNY_STORAGE_ZONE_PASSWORD }} | |
| 50 | + enable-delete-action: true | |
| 51 | + enable-purge-pull-zone: true | |
| 52 | + pull-zone-id: ${{ vars.BUNNY_PULL_ZONE_ID }} | |
| 53 | + concurrency: 50 | |
| 54 | + replication-timeout: "15000" | |
| 55 | + request-timeout: "15000" | |
| 56 | + retry-limit: "6" | |
| new file mode 100644 | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | +# Builds the showcase site (site/) and uploads it to Bunny CDN, served as https://skilly.eventuallycoding.com. | ||
| 2 | +# Only runs when the site, the screenshots or the favicon it uses, or this file change. | ||
| 3 | +# | ||
| 4 | +# The build has no dependencies (plain node), so there is no install step and ubuntu-latest is enough. | ||
| 5 | +# | ||
| 6 | +# Repository settings: secrets BUNNY_ACCESS_KEY and BUNNY_STORAGE_ZONE_PASSWORD, variables | ||
| 7 | +# BUNNY_STORAGE_ZONE (storage zone name) and BUNNY_PULL_ZONE_ID (pull zone purged after the upload). | ||
| 8 | +name: Deploy site | ||
| 9 | + | ||
| 10 | +on: | ||
| 11 | + push: | ||
| 12 | + branches: ["main"] | ||
| 13 | + paths: | ||
| 14 | + - "site/**" | ||
| 15 | + - "media/screenshots/**" | ||
| 16 | + - "packages/ui/public/favicon.svg" | ||
| 17 | + - ".rickub/workflows/deploy-site.yml" | ||
| 18 | + workflow_dispatch: | ||
| 19 | + | ||
| 20 | +# Workflow level: rickub ignores job-level concurrency. Deployments queue, none is cancelled | ||
| 21 | +concurrency: | ||
| 22 | + group: deploy-site | ||
| 23 | + cancel-in-progress: false | ||
| 24 | + | ||
| 25 | +jobs: | ||
| 26 | + deploy: | ||
| 27 | + runs-on: ubuntu-latest | ||
| 28 | + | ||
| 29 | + steps: | ||
| 30 | + - name: Checkout code | ||
| 31 | + uses: actions/checkout@v4 | ||
| 32 | + | ||
| 33 | + - name: Setup Node.js | ||
| 34 | + uses: actions/setup-node@v4 | ||
| 35 | + with: | ||
| 36 | + node-version: '22' | ||
| 37 | + | ||
| 38 | + - name: Build site | ||
| 39 | + run: node site/build.mjs | ||
| 40 | + | ||
| 41 | + # enable-delete-action removes from the storage zone every file absent from site/dist | ||
| 42 | + - name: Deploy to Bunny CDN | ||
| 43 | + uses: R-J-dev/bunny-deploy@v2.1.1 | ||
| 44 | + with: | ||
| 45 | + access-key: ${{ secrets.BUNNY_ACCESS_KEY }} | ||
| 46 | + directory-to-upload: "site/dist" | ||
| 47 | + storage-endpoint: "https://storage.bunnycdn.com" | ||
| 48 | + storage-zone-name: ${{ vars.BUNNY_STORAGE_ZONE }} | ||
| 49 | + storage-zone-password: ${{ secrets.BUNNY_STORAGE_ZONE_PASSWORD }} | ||
| 50 | + enable-delete-action: true | ||
| 51 | + enable-purge-pull-zone: true | ||
| 52 | + pull-zone-id: ${{ vars.BUNNY_PULL_ZONE_ID }} | ||
| 53 | + concurrency: 50 | ||
| 54 | + replication-timeout: "15000" | ||
| 55 | + request-timeout: "15000" | ||
| 56 | + retry-limit: "6" | ||