Workflow fix #9
This file contains hidden or 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 on commit to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - master | |
| # Add permissions for the workflow | |
| permissions: | |
| contents: write | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Load and export environment variables from .env | |
| run: | | |
| echo "Loading .env" | |
| if [ -f .env ]; then | |
| while IFS='=' read -r key value; do | |
| if [[ "$key" =~ ^[A-Za-z_][A-Za-z0-9_]*$ ]]; then | |
| echo "$key=$value" >> $GITHUB_ENV | |
| fi | |
| done < .env | |
| fi | |
| - name: Print vars | |
| run: | | |
| echo "Using theme: $VITE_CV_THEME" | |
| echo "Page title: $VITE_PAGE_TITLE" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| env: | |
| VITE_BASE_URL: /${{ github.event.repository.name }}/ | |
| VITE_CV_THEME: ${{ env.VITE_CV_THEME }} | |
| VITE_PAGE_TITLE: ${{ env.VITE_PAGE_TITLE }} | |
| run: | | |
| echo "Building with base URL: $VITE_BASE_URL" | |
| echo "Using theme: $VITE_CV_THEME" | |
| echo "Using page title: $VITE_PAGE_TITLE" | |
| npm run build | |
| cp dist/index.html dist/404.html | |
| - name: Deploy | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| folder: dist | |
| branch: gh-pages |