Last active
July 15, 2024 12:56
-
-
Save thevolcanomanishere/97dc055230a615880acaadd2a5af9648 to your computer and use it in GitHub Desktop.
Deploy to Cloudflare Pages example Github Action
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 React Static to Cloudflare Pages | |
on: | |
push: | |
branches: ["main"] | |
paths: | |
- "path/to/project/**" | |
pull_request: | |
branches: ["main"] | |
paths: | |
- "path/to/project/**" | |
workflow_dispatch: | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
environment: production | |
permissions: | |
contents: read | |
deployments: write | |
name: Deploy to Cloudflare Pages | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Run your project's build step | |
- name: Build | |
env: | |
VITE_BASE_URL: ${{vars.VITE_BASE_URL}} | |
run: yarn install --frozen-lockfile && yarn build | |
- name: Publish | |
uses: cloudflare/pages-action@v1 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: yourProjectName # e.g. 'my-project' | |
directory: fpath/to/project/dist # e.g. 'dist' | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
wranglerVersion: 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment