-
Notifications
You must be signed in to change notification settings - Fork 11
62 lines (57 loc) · 2.1 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
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