-
Notifications
You must be signed in to change notification settings - Fork 18
62 lines (51 loc) · 1.74 KB
/
build.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
name: Deploy site
on:
push: { branches: [master] }
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
# if: github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Restore file mtime
run: |
git ls-files -z | while read -d '' path; do
if [[ -e "$path" ]]; then
touch -d $(git log -1 --format="@%ct" "$path") "$path"
fi
done
- name: Install ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Install gems
run: gem install redcarpet rouge
- name: Set environment variables
run: echo "SITE_ROOT=deploy" >> $GITHUB_ENV
- name: Build (for forks)
if: ${{ github.repository_owner != 'lite-xl' }}
run: ruby site.rb "/$(echo '${{ github.repository }}' | cut -d/ -f2)"
- name: Build (for lite-xl org)
if: ${{ github.repository_owner == 'lite-xl' }}
run: ruby site.rb
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: website
path: ./deploy
compression-level: 9
- name: Upload to GitHub pages (for lite-xl org)
if: ${{ github.repository_owner == 'lite-xl' && github.ref_name == 'master' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./deploy
cname: lite-xl.com
- name: Upload to GitHub pages (for forks)
if: ${{ github.repository_owner != 'lite-xl' && github.ref_name == 'master' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./deploy