Merge pull request #8 from hwahyeon/main #96
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@v2 | |
name: Checkout src repo | |
with: | |
path: src | |
ref: main | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '^1.18.1' # The Go version to download (if necessary) and use. | |
- name: Install hugo | |
working-directory: src | |
run: | | |
wget https://github.com/gohugoio/hugo/releases/download/v0.99.1/hugo_extended_0.99.1_Linux-64bit.deb -O hugo.deb | |
DEBIAN_FRONTEND=noninteractive sudo dpkg -i hugo.deb | |
wget 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: Build website with hugo | |
working-directory: src | |
run: | | |
hugo mod get | |
cd themes/ubuntukr && npm i && cd ../../ | |
hugo | |
# Checkout destination branch | |
- uses: actions/checkout@v2 | |
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 ../src/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 |