-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (53 loc) · 1.71 KB
/
static-deployment.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
name: Deploy static content to Pages
on:
push:
branches: ["*"]
tags:
- "*.*"
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy:
environment:
name: ${{ github.ref_name == 'dev' && 'github-pages-dev' || 'github-pages' }}
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Determine Deploy Path
id: vars
run: |
# Use the same DEPLOY_PATH format for both branches and tags
export DEPLOY_PATH="${{ github.ref_name }}"
echo "DEPLOY_PATH=$DEPLOY_PATH" >> $GITHUB_ENV
- name: Prepare Deployment Directory
run: |
mkdir -p "public/$DEPLOY_PATH"
shopt -s extglob
cp -r !(public) "public/$DEPLOY_PATH"
- name: Generate Index.html
run: |
INDEX_PATH="public/index.html"
echo "<html><body><h1>Deployed Branches and Tags</h1><ul>" > $INDEX_PATH
# Iterate through all directories in 'public' and add to the index
for dir in $(ls -d public/*/); do
DIR_NAME=$(basename "$dir")
echo "<li><a href='/firstspirit-snap-extension/${DIR_NAME}/'>${DIR_NAME}</a></li>" >> $INDEX_PATH
done
echo "</ul></body></html>" >> $INDEX_PATH
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'public'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4