Skip to content

Update README.md

Update README.md #39

Workflow file for this run

name: github pages
on:
push:
branches:
- main # deploy main. If your branch is `master`, you'll have to replace that throughout this file.
pull_request: # This will publish a site preview on every pull request, and also run the build command to test if the site is broken.
jobs:
deploy:
runs-on: ubuntu-20.04
env:
PR_PATH: pull/${{github.event.number}}
steps:
- name: Comment on PR
uses: hasura/[email protected]
if: github.ref != 'refs/heads/main'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
number: ${{ github.event.number }}
id: deploy-preview
message: "Starting deployment of preview ⏳..."
- name: Set domain
run: echo "DOMAIN=40fy.dotkg.in" >> $GITHUB_ENV # TODO set your custom domain
# If you're using the default github pages url, use this instead:
# run: echo "DOMAIN=${{ github.actor }}.github.io" >> $GITHUB_ENV
- name: Checkout website repo
uses: actions/checkout@v2
with:
submodules: true # fetch the theme
# you need to set this as an environment env if your repo or any submodules (e.g the theme) is private:
# token: ${{ secrets.PRIVATE_REPO_TOKEN }}
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.128.0" # TODO set this to your hugo version
extended: true
- name: Set production base URL
run: echo "BASE_URL=https://${{ env.DOMAIN }}/" >> $GITHUB_ENV
- name: Build website
run: hugo
env:
HUGO_ENV: netlify
- name: Deploy if this is the `main` branch
uses: JamesIves/github-pages-deploy-action@v4
if: github.ref == 'refs/heads/main'
with:
token: ${{ secrets.GITHUB_TOKEN }}
folder: ./public
# cname: ${{ env.DOMAIN }}
force: false
clean: true
clean-exclude: pull/
- name: Set base URL for preview if PR
if: github.ref != 'refs/heads/main'
run: echo "BASE_URL=https://${{ env.DOMAIN }}/${{ env.PR_PATH}}/" >> $GITHUB_ENV
- name: Build PR preview website
if: github.ref != 'refs/heads/main'
run: hugo --baseURL "${{ env.BASE_URL }}"
env:
HUGO_ENV: staging
- name: Deploy to PR preview
uses: peaceiris/actions-gh-pages@v3
if: github.ref != 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
destination_dir: ${{ env.PR_PATH }} # TODO you need to set this if you're using a custom domain. Otherwise you can remove it.
- name: Update comment
uses: hasura/[email protected]
if: github.ref != 'refs/heads/main'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
number: ${{ github.event.number }}
id: deploy-preview
message: "A preview of ${{ github.event.after }} is uploaded and can be seen here:\n\n ✨ ${{ env.BASE_URL }} ✨\n\nChanges may take a few minutes to propagate. Since this is a preview of production, content with `draft: true` will not be rendered. The source is here: https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/"