-
-
Notifications
You must be signed in to change notification settings - Fork 17
157 lines (127 loc) · 3.83 KB
/
build-website.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Build Website
on:
schedule:
- cron: '00 00 * * 0'
push:
branches: [ master, gh-pages ]
release:
types: [published]
concurrency:
group: 'pages'
cancel-in-progress: true
jobs:
build-docs-stable:
runs-on: ubuntu-latest
steps:
- name: Get latest release with tag
id: latestrelease
run: |
echo "releasetag=$(curl -s https://api.github.com/repos/spartacus04/jext-reborn/releases/latest | jq '.tag_name' | sed 's/\"//g')" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ env.releasetag }}
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: adopt
- name: Cache Gradle dependencies
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.OS }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.OS }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build docs with Gradle
run: ./gradlew dokkaGeneratePublicationHtml
env:
jextVersion: ${{ env.releasetag }}
- name: Upload docs
uses: actions/upload-artifact@v4
with:
name: stabledocs
path: build/dokka/html/
build-docs-latest:
runs-on: ubuntu-latest
steps:
- name: Get latest commit hash
id: latestcommit
run: |
echo "commitsha=$(curl -s https://api.github.com/repos/spartacus04/jext-reborn/branches/master | jq -r '.commit.sha' | cut -c1-7)" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
ref: master
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: adopt
- name: Cache Gradle dependencies
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.OS }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.OS }}-gradle-
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build docs with Gradle
run: ./gradlew dokkaGeneratePublicationHtml
env:
jextVersion: ${{ steps.latestcommit.outputs.commitsha }}
- name: Upload docs
uses: actions/upload-artifact@v4
with:
name: devdocs
path: build/dokka/html/
build-publish:
permissions:
pages: write
id-token: write
needs:
- build-docs-stable
- build-docs-latest
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
with:
ref: gh-pages
- name: Download stable docs
uses: actions/download-artifact@v4
with:
name: stabledocs
path: static/docs/stable-javadocs
- name: Download dev docs
uses: actions/download-artifact@v4
with:
name: devdocs
path: static/docs/development-javadocs
- uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install
- name: Build site
run: bun run build
- name: Delete docs artifacts
uses: geekyeggo/delete-artifact@v5
with:
name: |
stabledocs
devdocs
- name: Fix permissions
run: |
chmod -c -R +rX "build/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload site
uses: actions/upload-pages-artifact@v3
with:
path: build/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4