Skip to content
This repository has been archived by the owner on Jul 20, 2024. It is now read-only.

Commit

Permalink
Use cf-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
danielfrg committed Feb 10, 2024
1 parent 198bf2d commit 4e90ead
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/deploy-cf-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: deploy-cf-pages

on:
workflow_call:
secrets:
CLOUDFLARE_ACCOUNT_ID:
required: true
CLOUDFLARE_TOKEN:
required: true
jobs:
prod:
# if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main'

permissions:
contents: read
id-token: write
pull-requests: write
checks: write

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Restore built website
uses: actions/cache@v4
with:
path: dist
key: >
website
${{ github.run_id }}
${{ github.run_attempt }}
fail-on-cache-miss: true

- name: Publish to Cloudflare Pages
id: cloudflare-pages-deploy
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CLOUDFLARE_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: illusionist-danielfrg-com
directory: dist

- name: Comment deploy url
uses: mshick/add-pr-comment@v2
with:
message-id: cloudflare-deploy
message: |
### <span aria-hidden="true">✅</span> Preview deployment
| Name | Link |
|---------------------------------|------------------------|
| Deploy Preview Url | [${{ steps.cloudflare-pages-deploy.outputs.url }}](${{ steps.cloudflare-pages-deploy.outputs.url }}) |
| Latest deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| Latest commit | ${{ github.sha }} |
| Environment | ${{ steps.cloudflare-pages-deploy.outputs.environment }} |
28 changes: 28 additions & 0 deletions .github/workflows/deploy-post.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: deploy-post

on:
workflow_call:
secrets:
CLOUDFLARE_ZONE:
required: true
CLOUDFLARE_TOKEN:
required: true

jobs:
clear-cache:
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main'

permissions:
contents: read
id-token: write
pull-requests: write
checks: write

runs-on: ubuntu-latest

steps:
- name: Purge Cloudflare Cache
uses: jakejarvis/[email protected]
env:
CLOUDFLARE_ZONE: ${{ secrets.CLOUDFLARE_ZONE }}
CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }}

0 comments on commit 4e90ead

Please sign in to comment.