Skip to content

New post! Redirect URL paths for free on cloudflare pages. #49

New post! Redirect URL paths for free on cloudflare pages.

New post! Redirect URL paths for free on cloudflare pages. #49

Workflow file for this run

name: Build and deploy
on:
push:
workflow_dispatch:
jobs:
build-and-deploy:
name: build and deploy
runs-on: ubuntu-latest
environment:
name: website
url: https://fariszr.com
steps:
- name: checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.111.3'
extended: true
- name: Github action cache
uses: actions/cache@v2
with:
path: /tmp/hugo_cache
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-hugomod-
- name: Build
run: hugo --minify -v --gc --baseURL https://fariszr.com --destination fariszr.com
- name: Include _headers file
run: cp _headers fariszr.com/_headers
- name: Include _redirects file
run: cp _redirects fariszr.com/_redirects
- name: Publish to Cloudflare Pages
if: github.event_name != 'pull_request'
uses: cloudflare/pages-action@v1.5.0
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ID }}
projectName: fariszr
directory: fariszr.com
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: main
- name: Publish preview to Cloudflare Pages
if: github.event_name == 'pull_request'
uses: cloudflare/pages-action@v1.5.0
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ID }}
projectName: fariszr
directory: fariszr.com
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref.name }}