-
Notifications
You must be signed in to change notification settings - Fork 28
121 lines (104 loc) · 4.02 KB
/
Copy pathdeploy.yml
File metadata and controls
121 lines (104 loc) · 4.02 KB
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
name: Deploy to GitHub Pages
on:
push:
branches: [main]
paths:
- 'content/**'
- 'translations/**'
- 'templates/**'
- 'site/**'
- 'html-generators/generateog.java'
- 'html-generators/og/**'
- 'html-generators/tags.properties'
- 'html-generators/categories.properties'
workflow_run:
workflows: ['Build Project JARs']
types: [completed]
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 2
- name: Prepare generation
id: changes
run: |
# Generated HTML and OG images are gitignored, so every deployment
# must recreate them before replacing the current Pages artifact.
echo "generate=true" >> "$GITHUB_OUTPUT"
echo "og=true" >> "$GITHUB_OUTPUT"
- uses: actions/setup-java@v6
if: steps.changes.outputs.generate == 'true' || steps.changes.outputs.og == 'true'
with:
distribution: 'temurin'
java-version: '25'
# --- HTML generation (content/templates/translations changed) ---
- name: Restore cached generate JAR and AOT
id: cache-restore
if: steps.changes.outputs.generate == 'true'
uses: actions/cache/restore@v6
with:
path: |
html-generators/generate.jar
html-generators/generate.aot
key: generator-${{ hashFiles('html-generators/generate.java') }}
- name: Generate HTML with cached JAR + AOT
if: steps.changes.outputs.generate == 'true' && steps.cache-restore.outputs.cache-hit == 'true'
run: java -XX:Tier4CompileThreshold=100 -XX:AOTCache=html-generators/generate.aot -jar html-generators/generate.jar
- name: Setup JBang (cache miss)
if: steps.changes.outputs.generate == 'true' && steps.cache-restore.outputs.cache-hit != 'true'
uses: jbangdev/setup-jbang@main
- name: Generate HTML with JBang (cache miss)
if: steps.changes.outputs.generate == 'true' && steps.cache-restore.outputs.cache-hit != 'true'
run: jbang html-generators/generate.java
# --- OG card generation (content/templates/translations or generateog.java changed) ---
- name: Restore cached generateog JAR and AOT
id: cache-restore-og
if: steps.changes.outputs.og == 'true'
uses: actions/cache/restore@v6
with:
path: |
html-generators/generateog.jar
html-generators/generateog.aot
key: generateog-${{ hashFiles('html-generators/generateog.java') }}
- name: Generate OG cards with cached JAR + AOT
if: steps.changes.outputs.og == 'true' && steps.cache-restore-og.outputs.cache-hit == 'true'
run: java -XX:Tier4CompileThreshold=100 -XX:AOTCache=html-generators/generateog.aot -jar html-generators/generateog.jar
- name: Generate OG cards with JBang (cache miss)
if: steps.changes.outputs.og == 'true' && steps.cache-restore-og.outputs.cache-hit != 'true'
run: |
if ! command -v jbang &> /dev/null; then
echo "Installing JBang..."
curl -Ls https://sh.jbang.dev | bash -s - app setup
export PATH="$HOME/.jbang/bin:$PATH"
fi
jbang html-generators/generateog.java
- name: Verify Pages artifact
run: test -s site/index.html
- name: Setup Pages
uses: actions/configure-pages@v6
- name: Upload artifact
uses: actions/upload-pages-artifact@v5
with:
path: site
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5