Update static-deployment.yml #17
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |