-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (52 loc) · 2.02 KB
/
publish.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: Render Quarto Files and Deploy to GitHub Pages
on:
push:
branches:
- main
paths-ignore:
- '.devcontainer/**'
workflow_dispatch: # Manual trigger
jobs:
render_quarto:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
# - name: Build Docker image
# run: |
# docker build -t demo-quarto-image .
- name: Create gallery directory on the host
run: |
echo 'Creating gallery directory...'
mkdir -p gallery && chmod -R 777 gallery
echo 'gallery directory created.'
- name: Run Quarto in Docker container
run: |
docker run --rm -v ${{ github.workspace }}:/workspace -w /workspace mewu/data_access:latest bash -c "chmod +x ./run_quarto_publish.sh && ./run_quarto_publish.sh"
- name: Generate Index HTML
run: |
ls -laR gallery
echo "<html><body><h1>IDM Data Access / Analysis Gallery</h1><ul>" > gallery/index.html
find gallery -name "*.html" -not -name "index.html" | while read -r file; do
# Remove the 'gallery/' prefix from the file path
relative_path="${file#gallery/}"
file_name=$(basename "$file" .html)
echo "<li>$file_name <a href=\"./$relative_path\">$relative_path</a></li>" >> gallery/index.html
done
echo "</ul></body></html>" >> gallery/index.html
- name: Upload HTML output
uses: actions/upload-artifact@v4
with:
name: gallery
path: gallery/
- name: Set up Git user
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gallery # Path to the folder that you want to publish (the gallery folder)
publish_branch: docs # The branch used for GitHub Pages