feat: add GitHub Actions workflows for deployment and theme updates
This commit is contained in:
53
.github/workflows/deploy.yaml
vendored
Normal file
53
.github/workflows/deploy.yaml
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
name: Deploy to Github Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
# Give the default GITHUB_TOKEN write permission to commit and push the
|
||||
# added or changed files to the repository.
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Cache Hugo resources
|
||||
uses: actions/cache@v4
|
||||
env:
|
||||
cache-name: cache-hugo-resources
|
||||
with:
|
||||
path: resources
|
||||
key: ${{ env.cache-name }}
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "^1.24.2"
|
||||
run: go version
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v3
|
||||
with:
|
||||
hugo-version: "latest"
|
||||
extended: true
|
||||
|
||||
- name: Build
|
||||
run: hugo --minify --gc
|
||||
|
||||
- name: Deploy 🚀
|
||||
uses: JamesIves/github-pages-deploy-action@v4
|
||||
with:
|
||||
branch: gh-pages
|
||||
folder: public
|
||||
clean: true
|
||||
single-commit: true
|
38
.github/workflows/update-theme.yaml
vendored
Normal file
38
.github/workflows/update-theme.yaml
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
name: Update theme
|
||||
|
||||
# Controls when the workflow will run
|
||||
on:
|
||||
schedule:
|
||||
# Update theme automatically everyday at 00:00 UTC
|
||||
- cron: "0 0 * * *"
|
||||
# Allows you to run this workflow manually from the Actions tab
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
update-theme:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
# Give the default GITHUB_TOKEN write permission to commit and push the
|
||||
# added or changed files to the repository.
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v3
|
||||
with:
|
||||
hugo-version: "latest"
|
||||
extended: true
|
||||
|
||||
- name: Update theme
|
||||
run: hugo mod get -u github.com/geekifan/hugo-theme-chirpy
|
||||
|
||||
- name: Tidy go.mod, go.sum
|
||||
run: hugo mod tidy
|
||||
|
||||
- name: Commit changes
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "CI: Update theme"
|
Reference in New Issue
Block a user