Rewrite profile #117
This file contains 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: Build for Cloudflare | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
deployments: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v3 | |
with: | |
hugo-version: "0.110.0" | |
- name: build | |
run: make publish-cloudflare | |
- name: Publish to Preview Env | |
uses: cloudflare/pages-action@1 | |
if: github.event_name == 'pull_request' && github.event.pull_request.merged == false | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: "karlhaworth-com-hugo" | |
directory: "public" | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${GITHUB_REF#refs/heads/} | |
- name: Publish to Prod | |
uses: cloudflare/pages-action@1 | |
if: github.event_name != 'pull_request' | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: "karlhaworth-com-hugo" | |
directory: "public" | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} |