72 lines
1.5 KiB
YAML
72 lines
1.5 KiB
YAML
# Sample workflow for building and deploying a Hugo site to GitHub Pages
|
|
name: Deploy Hugo site to Staging (Pages)
|
|
|
|
on: {}
|
|
# # Runs on pushes targeting the default branch
|
|
# push:
|
|
# branches: ["master"]
|
|
|
|
# # Allows you to run this workflow manually from the Actions tab
|
|
# workflow_dispatch:
|
|
|
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
# Allow one concurrent deployment
|
|
concurrency:
|
|
group: "pages"
|
|
cancel-in-progress: true
|
|
|
|
# Default to bash
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
# Build job
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
name: Build Pages
|
|
steps:
|
|
- name: Install Hugo CLI
|
|
run: sudo apt install hugo
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Setup Pages
|
|
id: pages
|
|
uses: actions/configure-pages@v1
|
|
|
|
- name: Build with Hugo
|
|
run: |
|
|
hugo \
|
|
--minify \
|
|
--baseURL ${{ steps.pages.outputs.base_url }}
|
|
|
|
- name: Write CNAME
|
|
run: echo new.sarsoo.xyz > ./public/CNAME
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-pages-artifact@v1
|
|
with:
|
|
path: ./public
|
|
|
|
# Deployment job
|
|
deploy:
|
|
name: Deploy Staging
|
|
environment:
|
|
name: staging
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
steps:
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v1
|