Skip to content

fix: don't write index file #138

fix: don't write index file

fix: don't write index file #138

Workflow file for this run

# https://github.com/orgs/community/discussions/21582
name: Build and Publish Storybook to GitHub Pages
on:
# Event for the workflow to run on
push:
branches:
- '**' # Run on all branches
permissions:
contents: write
pages: write
id-token: write
actions: read
concurrency:
group: "pages"
cancel-in-progress: true
# List of jobs
jobs:
build_matrix:
runs-on: ubuntu-latest
outputs:
json_branches: ${{ steps.generate-matrix.outputs.json_branches }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate Matrix
id: generate-matrix
run: |
branches=($(git branch -r | cut -c 3- | sed 's/origin\///g'))
json_branches=$(printf '%s\n' "${branches[@]}" | jq -R . | jq -s -c .)
echo "json_branches=${json_branches}" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-latest
name: Build
needs:
- build_matrix
strategy:
matrix:
branch: ${{ fromJSON(needs.build_matrix.outputs.json_branches) }}
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.branch }}
- uses: actions/setup-node@v4
with:
node-version: '22.x'
- name: Install dependencies
run: npm ci
- name: Build Storybook
run: npm run build-storybook
- uses: actions/upload-artifact@v3
with:
name: ${{ strategy.job-index }}
path: storybook-static/
deploy:
runs-on: ubuntu-latest
name: Deploy
if: always()
needs:
- build_matrix
- build
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Pages
uses: actions/configure-pages@v5
- run: gh run download ${{ vars.GITHUB_RUN_ID }} --dir branches
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create public folder
run: |
branches=$(echo '${{ needs.build_matrix.outputs.json_branches }}' | jq -r '.[]')
i=0
for branch in ${branches}
do
mkdir -p -- $branch
mv ../branches/$i/* ./$branch
echo "<li><a href=\"./CV/${branch}\">${branch}</a></li>"
i=$((i+1))
done
ls -lR
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./public/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4