forked from victoriadrake/hugo-remote
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhugo-remote.yml
57 lines (53 loc) · 1.71 KB
/
hugo-remote.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
name: hugo-remote
on:
push:
branches:
- master
# Don't forget to set these!
env:
REMOTE: # username/username.github.io.git
DEST: # public
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: 🛎 Check out master
uses: actions/checkout@master
with:
fetch-depth: 1
- name: 🔨 Set up Node
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: 🔧 Install tools
run: |
sudo apt install curl jq
npm install postcss-cli autoprefixer
- name: 🤵 Install latest Hugo
run: |
HUGO_VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | jq -r '.tag_name')
mkdir tmp/ && cd tmp/
curl -sSL https://github.com/gohugoio/hugo/releases/download/${HUGO_VERSION}/hugo_extended_${HUGO_VERSION: -6}_Linux-64bit.tar.gz | tar -xvzf-
sudo mv hugo /usr/local/bin/
cd .. && rm -rf tmp/
hugo version
- name: 👯 Clone remote repository
run: git clone https://github.com/${REMOTE} ${DEST}
- name: 🧹 Clean site
run: |
if [ -d "${DEST}" ]; then
rm -rf ${DEST}/*
fi
- name: 🍳 Build site
run: hugo -d ${DEST}
- name: 🎁 Publish to remote repository
env:
TOKEN: ${{ secrets.TOKEN }}
run: |
cd ${DEST}
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add .
git status
git commit -am "🚀 Deploy with ${GITHUB_WORKFLOW}"
git push -f -q https://${{ secrets.TOKEN }}@github.com/${REMOTE} master