-
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (57 loc) · 1.87 KB
/
CI.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
63
64
65
66
67
68
69
70
71
72
name: CI
on: pull_request
env:
REPO_NAME: ${{ github.event.repository.name }}
jobs:
Build:
runs-on: ubuntu-latest
container:
image: docker.io/library/alpine:latest
options: --privileged
steps:
- name: Update container
run: apk update && apk upgrade
- name: Install packages
run: apk add git hugo
- name: Clone repo and configure git
run: |
git clone https://github.com/$GITHUB_REPOSITORY
cd $REPO_NAME
git checkout $GITHUB_HEAD_REF
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git remote set-url origin "https://${{ secrets.BUILD_WEBSITE_TOKEN }}@github.com/$GITHUB_REPOSITORY.git"
- name: Build website
run: |
cd $REPO_NAME
if [ "$(git log -n 1 --pretty=format:%an)" != "GitHub Actions" ]; then
rm -rf public && hugo
else
echo "Website already built in the latest commit"
fi
- name: Commit automated build
run: |
cd $REPO_NAME
if [ "$(git status --porcelain)" ]; then
git add .
git commit -m "Automated build"
git push
else
echo "No changes to commit"
fi
Test:
runs-on: ubuntu-latest
container:
image: docker.io/library/alpine:latest
options: --privileged
steps:
- name: Clone repo
uses: actions/checkout@v3
- name: Update container
run: apk update && apk upgrade
- name: Install packages
run: apk add py3-pip ruby && pip install codespell && gem install mdl
- name: Run codespell
run: codespell --enable-colors content
- name: Run mdl
run: mdl --style .github/workflows/mdl_style.rb README.md content