tangled
alpha
login
or
join now
mmatt.net
/
webtech
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
comeon kimi k2.5!
mmatt.net
1 month ago
bf2eb961
3b72663c
+55
-51
1 changed file
expand all
collapse all
unified
split
.github
workflows
deploy-sites.yaml
+55
-51
.github/workflows/deploy-sites.yaml
···
34
34
sites+=("${dir%/}")
35
35
fi
36
36
done
37
37
-
38
38
-
# Create JSON array for matrix strategy
39
39
-
sites_json=$(printf '%s\n' "${sites[@]}" | jq -R . | jq -s .)
37
37
+
38
38
+
# Create JSON array and output on single line
39
39
+
sites_json=$(printf '%s\n' "${sites[@]}" | jq -R . | jq -s -c .)
40
40
echo "sites=$sites_json" >> $GITHUB_OUTPUT
41
41
echo "Found sites: $sites_json"
42
42
···
54
54
run: |
55
55
mkdir -p _site/${{ matrix.site }}
56
56
cp -r ${{ matrix.site }}/* _site/${{ matrix.site }}/
57
57
-
58
58
-
# Create a root index if it doesn't exist
59
59
-
if [ ! -f "_site/index.html" ]; then
60
60
-
cat > _site/index.html << 'EOF'
61
61
-
<!DOCTYPE html>
62
62
-
<html>
63
63
-
<head>
64
64
-
<title>Sites Index</title>
65
65
-
<style>
66
66
-
body { font-family: system-ui, sans-serif; max-width: 800px; margin: 40px auto; padding: 20px; }
67
67
-
h1 { color: #333; }
68
68
-
ul { list-style: none; padding: 0; }
69
69
-
li { margin: 10px 0; }
70
70
-
a { color: #0366d6; text-decoration: none; font-size: 1.1em; }
71
71
-
a:hover { text-decoration: underline; }
72
72
-
</style>
73
73
-
</head>
74
74
-
<body>
75
75
-
<h1>📁 Available Sites</h1>
76
76
-
<ul id="sites-list"></ul>
77
77
-
<script>
78
78
-
const sites = document.getElementById('sites-list');
79
79
-
const paths = window.location.pathname.split('/').filter(p => p);
80
80
-
const basePath = paths.length > 0 ? '/' + paths.join('/') : '';
81
81
-
82
82
-
fetch(basePath + '/sites.json')
83
83
-
.then(r => r.json())
84
84
-
.then(data => {
85
85
-
data.forEach(site => {
86
86
-
const li = document.createElement('li');
87
87
-
const a = document.createElement('a');
88
88
-
a.href = './' + site + '/';
89
89
-
a.textContent = site;
90
90
-
li.appendChild(a);
91
91
-
sites.appendChild(li);
92
92
-
});
93
93
-
});
94
94
-
</script>
95
95
-
</body>
96
96
-
</html>
97
97
-
EOF
98
98
-
fi
99
57
100
58
- name: Upload site artifact
101
59
uses: actions/upload-artifact@v4
···
103
61
name: site-${{ matrix.site }}
104
62
path: _site
105
63
64
64
+
create-index:
65
65
+
runs-on: ubuntu-latest
66
66
+
needs: discover-sites
67
67
+
steps:
68
68
+
- name: Create root index
69
69
+
run: |
70
70
+
mkdir -p _site
71
71
+
cat > _site/index.html << 'EOF'
72
72
+
<!DOCTYPE html>
73
73
+
<html>
74
74
+
<head>
75
75
+
<title>Sites Index</title>
76
76
+
<style>
77
77
+
body { font-family: system-ui, sans-serif; max-width: 800px; margin: 40px auto; padding: 20px; }
78
78
+
h1 { color: #333; }
79
79
+
ul { list-style: none; padding: 0; }
80
80
+
li { margin: 10px 0; }
81
81
+
a { color: #0366d6; text-decoration: none; font-size: 1.1em; }
82
82
+
a:hover { text-decoration: underline; }
83
83
+
</style>
84
84
+
</head>
85
85
+
<body>
86
86
+
<h1>📁 Available Sites</h1>
87
87
+
<ul id="sites-list"></ul>
88
88
+
<script>
89
89
+
const sites = document.getElementById('sites-list');
90
90
+
fetch('./sites.json')
91
91
+
.then(r => r.json())
92
92
+
.then(data => {
93
93
+
data.forEach(site => {
94
94
+
const li = document.createElement('li');
95
95
+
const a = document.createElement('a');
96
96
+
a.href = './' + site + '/';
97
97
+
a.textContent = site;
98
98
+
li.appendChild(a);
99
99
+
sites.appendChild(li);
100
100
+
});
101
101
+
});
102
102
+
</script>
103
103
+
</body>
104
104
+
</html>
105
105
+
EOF
106
106
+
echo '${{ needs.discover-sites.outputs.sites }}' > _site/sites.json
107
107
+
108
108
+
- name: Upload index artifact
109
109
+
uses: actions/upload-artifact@v4
110
110
+
with:
111
111
+
name: site-index
112
112
+
path: _site
113
113
+
106
114
merge-and-deploy:
107
115
runs-on: ubuntu-latest
108
108
-
needs: [discover-sites, build]
116
116
+
needs: [discover-sites, build, create-index]
109
117
steps:
110
118
- name: Download all artifacts
111
119
uses: actions/download-artifact@v4
···
114
122
pattern: site-*
115
123
merge-multiple: true
116
124
117
117
-
- name: Create sites index
118
118
-
run: |
119
119
-
echo '${{ needs.discover-sites.outputs.sites }}' > _site/sites.json
120
120
-
121
125
- name: Upload to GitHub Pages
122
126
uses: actions/upload-pages-artifact@v3
123
127
with:
124
128
path: _site
125
129
126
130
- name: Deploy to GitHub Pages
127
127
-
uses: actions/deploy-pages@v4
131
131
+
uses: actions/deploy-pages@v4