-
Notifications
You must be signed in to change notification settings - Fork 7
58 lines (49 loc) · 1.42 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
name: Deploy
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: gh-pages
- name: Checkout build environment
uses: actions/checkout@v2
with:
ref: main
path: build-environment
- name: Install Hugo
run: |
mkdir -p build-environment/.bin
curl "https://github.com/gohugoio/hugo/releases/download/v0.80.0/hugo_extended_0.80.0_Linux-64bit.tar.gz" \
--silent \
--location \
--output /tmp/hugo.tar.gz
tar -xOzvf /tmp/hugo.tar.gz 'hugo' > build-environment/.bin/hugo
chmod +x build-environment/.bin/hugo
rm /tmp/hugo.tar.gz
- name: Build
run: cd build-environment && .bin/hugo
- name: Update
run: |
git rm -r --ignore-unmatch .
cp -a build-environment/public/* .
rm -rf build-environment
- name: Commit
id: commit
run: |
git config --global user.email "[email protected]"
git config --global user.name "paketo-bot"
if [[ -n "$(git status --short)" ]]; then
git add --all .
git commit --message "Deploying"
echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
fi
- name: Push
if: ${{ steps.commit.outputs.commit_sha != '' }}
run: git push origin gh-pages