draft: hide post #278
This file contains 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: Deploy Website | |
on: | |
push: | |
branches: [ main ] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Check out latest commit | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
name: Checkout src repo | |
with: | |
ref: main | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '^1.13.1' | |
cache: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
cache: 'yarn' | |
cache-dependency-path: 'themes/v-framework/yarn.lock' | |
- name: Install hugo | |
run: | | |
wget --progress=bar:force:noscroll https://github.com/gohugoio/hugo/releases/download/v0.110.0/hugo_extended_0.110.0_linux-amd64.deb -O hugo.deb | |
DEBIAN_FRONTEND=noninteractive sudo dpkg -i hugo.deb | |
wget --progress=bar:force:noscroll https://github.com/sass/dart-sass-embedded/releases/download/1.52.1/sass_embedded-1.52.1-linux-x64.tar.gz -O dartsass.tar.gz | |
tar -xvzf dartsass.tar.gz | |
sudo cp sass_embedded/dart-sass-embedded /usr/bin/ | |
- name: check hugo mod | |
run: hugo mod get | |
- name: Install yarn dependencies | |
working-directory: 'themes/v-framework' | |
run: yarn install | |
- name: Build website with hugo | |
run: hugo | |
# Checkout destination branch | |
- uses: actions/checkout@v4 | |
name: Checkout dest repo | |
with: | |
path: dest | |
fetch-depth: 0 | |
ref: gh-pages | |
# Commit and push changes | |
- name: Copy website built from src/public | |
working-directory: dest | |
run: | | |
rm -rf * | |
yes | cp -rf ../public/* . | |
# Commit and push changes | |
- name: Commit website updates | |
working-directory: dest | |
run: | | |
git config --global user.name github-actions | |
git config --global user.email [email protected] | |
git add . | |
git diff-index --quiet HEAD || git commit -m "Deploy website updates with GitHub Actions: ${GITHUB_SHA}" | |
git push origin gh-pages |