Skip to content

Improves file existence checks and error handling in build process #5

Improves file existence checks and error handling in build process

Improves file existence checks and error handling in build process #5

# Workflow to merge cvclaude branch content into main branch's 360 subfolder
name: Merge CVClaude to 360 subfolder
on:
# Runs on pushes targeting the cvclaude branch
push:
branches: ["cvclaude"]
# Allows you to run this workflow manually from the Actions tab
# test
workflow_dispatch:
permissions:
contents: write
jobs:
merge-to-main:
runs-on: ubuntu-latest
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout cvclaude branch
uses: actions/checkout@v4
with:
ref: cvclaude
path: cvclaude-build
- name: Setup Node.js for cvclaude build
run: npm install
working-directory: ./cvclaude-build
- name: Build cvclaude for 360 subfolder
run: npm run build
working-directory: ./cvclaude-build
env:
BASE_PATH: /cv/360
- name: Create or update 360 subfolder in main
run: |
# Remove existing 360 folder if it exists
rm -rf 360
# Create 360 folder
mkdir -p 360
# List files to debug
echo "Files in cvclaude-build after build:"
ls -la cvclaude-build/
echo "Checking if specific files exist:"
ls -la cvclaude-build/index.html 2>/dev/null && echo "index.html exists" || echo "index.html does not exist"
ls -la cvclaude-build/index-fr.html 2>/dev/null && echo "index-fr.html exists" || echo "index-fr.html does not exist"
ls -la cvclaude-build/index-en.html 2>/dev/null && echo "index-en.html exists" || echo "index-en.html does not exist"
ls -la cvclaude-build/style.min.css 2>/dev/null && echo "style.min.css exists" || echo "style.min.css does not exist"
# Copy any existing HTML files and CSS to 360 folder
cp cvclaude-build/*.html cvclaude-build/*.css 360/ 2>/dev/null || echo "No files to copy"
# List files in 360 folder to verify
echo "Files copied to 360 folder:"
ls -la 360/
# Clean up cvclaude-build directory
rm -rf cvclaude-build
- name: Commit and push changes to main
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add 360/
git commit -m "Update 360 subfolder with cvclaude branch content [skip ci]" || echo "No changes to commit"
git push origin main