-
Notifications
You must be signed in to change notification settings - Fork 11
116 lines (98 loc) · 3.27 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
name: CI
on: [push, pull_request]
permissions:
actions: write
checks: write
contents: write
deployments: write
id-token: write
issues: write
discussions: write
packages: write
pages: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write
jobs:
linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: lilia
- uses: leafo/gh-actions-lua@v8.0.0
with:
luaVersion: "5.2"
- uses: leafo/gh-actions-luarocks@v4.0.0
- name: Pull gluacheck
uses: actions/checkout@v3
with:
repository: LiliaFramework/GluaCheck
path: luacheck
- name: Build gluacheck
working-directory: luacheck
run: luarocks make
- name: Lint
working-directory: lilia
run: |
luacheck . --no-redefined \
--no-global --no-self \
--no-max-line-length --no-max-code-line-length \
--no-max-string-line-length --no-max-comment-line-length \
--no-max-cyclomatic-complexity
docs:
runs-on: ubuntu-latest
needs: linter
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'LiliaFramework/Lilia' && success()
steps:
- uses: actions/checkout@v3
with:
path: lilia
- uses: leafo/gh-actions-lua@v8.0.0
with:
luaVersion: "5.2"
- uses: leafo/gh-actions-luarocks@v4.0.0
- name: Pull LDoc
uses: actions/checkout@v3
with:
repository: LiliaFramework/LDoc
path: ldoc
- name: Build LDoc
working-directory: ldoc
run: luarocks make
- name: Build docs
working-directory: lilia
run: ldoc . --fatalwarnings
- name: Copy assets
working-directory: lilia
run: |
cp -v docs/css/* docs/html
cp -v docs/js/* docs/html
- name: Deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'LiliaFramework/Lilia' && success()
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: lilia/docs/html
sync:
runs-on: ubuntu-latest
needs: docs
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'LiliaFramework/Lilia' && success()
steps:
- name: Checkout source repository
uses: actions/checkout@v3
- name: Push to destination repository
env:
GITHUB_TOKEN: ${{ secrets.LiliaGitSecret }}
ORIGINAL_REPO_NAME: ${{ github.event.repository.name }}
ORG_NAME: LiliaFramework
run: |
git config --global user.email "githubactions@github.com"
git config --global user.name "Github Actions"
git clone https://${ORG_NAME}:${GITHUB_TOKEN}@github.com/${ORG_NAME}/LiliaFramework.github.io.git liliagit
cd liliagit
git remote add ${ORIGINAL_REPO_NAME} https://${ORG_NAME}:${GITHUB_TOKEN}@github.com/${ORG_NAME}/${{ env.ORIGINAL_REPO_NAME }}.git
git remote update
git merge ${ORIGINAL_REPO_NAME}/gh-pages --allow-unrelated-histories gh-pages
git push origin gh-pages