Skip to content

Commit 5db61ed

Browse files
authored
Update main.yml
1 parent 8cc0eb0 commit 5db61ed

1 file changed

Lines changed: 33 additions & 24 deletions

File tree

.github/workflows/main.yml

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
name: Deploy slides
2+
23
on:
3-
push: { branches: [ main ] }
4+
push:
5+
branches: [ "main" ]
46
pull_request:
57

68
permissions:
79
contents: read
810
pages: write
911
id-token: write
1012

13+
concurrency:
14+
group: "pages"
15+
cancel-in-progress: true
16+
1117
jobs:
1218
build:
1319
runs-on: ubuntu-latest
@@ -18,43 +24,46 @@ jobs:
1824
submodules: true
1925

2026
- name: Generate index.html (root)
27+
shell: bash
2128
run: |
2229
set -euo pipefail
23-
{
24-
cat <<'HTML'
25-
<!doctype html><html lang="en"><head><meta charset="utf-8">
26-
<title>My Talks</title>
27-
<style>
28-
body { font-family: system-ui, sans-serif; max-width: 50rem; margin: 2rem auto; padding: 0 1rem; }
29-
h1 { margin: 0 0 1rem; }
30-
ul { list-style: none; padding: 0; }
31-
li { margin: .4rem 0; }
32-
a { text-decoration: none; color: #1565c0; font-weight: 500; }
33-
a:hover { text-decoration: underline; }
34-
</style></head><body><h1>My Talks</h1><ul>
35-
HTML
36-
# list only first-level dirs that contain index.html
37-
for d in */ ; do
38-
[ -f "${d}index.html" ] || continue
30+
cat > index.html <<'HTML'
31+
<!doctype html><html lang="en"><head><meta charset="utf-8">
32+
<title>My Talks</title>
33+
<style>
34+
body { font-family: system-ui, sans-serif; max-width: 50rem; margin: 2rem auto; padding: 0 1rem; }
35+
h1 { margin: 0 0 1rem; }
36+
ul { list-style: none; padding: 0; }
37+
li { margin: .4rem 0; }
38+
a { text-decoration: none; color: #1565c0; font-weight: 500; }
39+
a:hover { text-decoration: underline; }
40+
</style></head><body><h1>My Talks</h1><ul>
41+
HTML
42+
for d in */ ; do
43+
if [ -f "${d}index.html" ]; then
3944
name="${d%/}"
4045
title=$(grep -m1 -oP '(?i)(?<=<title>).*?(?=</title>)' "${d}index.html" || true)
4146
[ -n "$title" ] || title="$name"
42-
printf '<li><a href="%s/">%s</a></li>\n' "$name" "$title"
43-
done
44-
echo '</ul></body></html>'
45-
} > index.html
47+
printf '<li><a href="%s/">%s</a></li>\n' "$name" "$title" >> index.html
48+
fi
49+
done
50+
echo '</ul></body></html>' >> index.html
4651
47-
- name: Configure Pages
52+
- name: Setup Pages
4853
uses: actions/configure-pages@v4
4954

50-
- name: Upload artifact (root)
55+
- name: Upload artifact
5156
uses: actions/upload-pages-artifact@v3
5257
with:
5358
path: .
5459

5560
deploy:
5661
needs: build
5762
runs-on: ubuntu-latest
63+
environment:
64+
name: github-pages
65+
url: ${{ steps.deployment.outputs.page_url }}
5866
steps:
59-
- name: Deploy
67+
- name: Deploy to GitHub Pages
68+
id: deployment
6069
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)