Created
February 11, 2025 13:53
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: Build Jekyll site | |
on: | |
push: | |
branches: ["master"] | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- # https://github.com/actions/checkout | |
name: Checkout | |
uses: actions/checkout@v4 | |
- # https://github.com/actions/configure-pages | |
name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- # https://github.com/actions/jekyll-build-pages | |
name: Build | |
uses: actions/jekyll-build-pages@v1 | |
- # https://github.com/actions/upload-pages-artifact | |
name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
# will upload artifact.tar.gz as github-pages | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- # https://github.com/actions/deploy-pages | |
name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
publish: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- # https://github.com/actions/download-artifact | |
name: Download a single artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: github-pages | |
path: ./_site | |
# will download github-pages as ./_site/artifact.tar (not tar.gz!) | |
- # untar artifact.tar | |
name: Untar artifact.tar and remove | |
working-directory: ./_site | |
run: | | |
tar xvf ./artifact.tar && rm ./artifact.tar | |
- # https://github.com/cloudflare/wrangler-action | |
name: Publish to Cloudflare Pages | |
id: cloudflare | |
uses: cloudflare/wrangler-action@v3 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: pages deploy ./_site --project-name=${{ secrets.CLOUDFLARE_PAGES_PROJECT_NAME }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment