-
Notifications
You must be signed in to change notification settings - Fork 1
78 lines (76 loc) · 2.62 KB
/
publish.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
73
74
75
76
77
78
name: Publish
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ '14' ]
steps:
- uses: actions/checkout@v1
- name: Install dependencies
run: npm i
- name: Check syntax
run: npm run lint -- --fix --plugin log
- name: Sort
run: npm run sort
- name: commit auto fixes
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
BRANCH: ${{ github.ref }}
run: |
if [ "$(git diff --quiet && echo 0 || echo $?)" -gt 0 ]; then
git config --global user.email "${USERNAME}@users.noreply.github.com" --replace-all
git config --global user.name "$USERNAME" --replace-all
git commit -am "😎 Autofix"
git remote set-url origin https://$USERNAME:$TOKEN@github.com/$REPO.git
git push -u origin HEAD:${BRANCH}
exit 1
fi
- name: Test
run: npm t
- name: Clone docs and clean everything
if: github.ref == 'refs/heads/main'
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
run: |
git clone -b site --single-branch https://$USERNAME:$TOKEN@github.com/$REPO.git docs
cd docs
ls -a | grep -v .git | egrep -vU "\.$" | xargs rm -rf
cd -
- name: Install fonts
if: github.ref == 'refs/heads/main'
run: |
sudo mkdir /usr/share/fonts/opentype
cd /usr/share/fonts
sudo mkdir googlefonts
cd googlefonts
curl https://fonts.google.com/download?family=Roboto --output Roboto.zip
sudo unzip -d . Roboto.zip
sudo chmod -R --reference=/usr/share/fonts/opentype /usr/share/fonts/googlefonts
sudo fc-cache -fv
- name: Build
if: github.ref == 'refs/heads/main'
run: npm run build
- name: Check for changes and commit
if: github.ref == 'refs/heads/main'
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}
run: |
cd docs
git config --global user.email "${USERNAME}@users.noreply.github.com" --replace-all
git config --global user.name "$USERNAME" --replace-all
git add . --intent-to-add
if [ "$(git diff --quiet && echo 0 || echo $?)" -gt 0 ]; then
git diff --exit-code && exit 0
git add .
git commit -m "$(curl -s whatthecommit.com/index.txt)"
git remote set-url origin https://$USERNAME:$TOKEN@github.com/$REPO.git
git push origin site --force-with-lease
fi