fix: correct YAML syntax for multi-line git commit messages #1
Workflow file for this run
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 Web Resumes to GitHub Pages | ||
| on: | ||
| push: | ||
| branches: | ||
| - master | ||
| paths: | ||
| - 'resumes/customized/*/web/**' | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout source repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Clone CV-pages repository | ||
| env: | ||
| CV_PAGES_TOKEN: ${{ secrets.CV_PAGES_TOKEN }} | ||
| run: | | ||
| git clone https://x-access-token:${CV_PAGES_TOKEN}@github.com/datarian/CV-pages.git cv-pages-repo | ||
| cd cv-pages-repo | ||
| # Check if gh-pages branch exists, create if not | ||
| if git ls-remote --heads origin gh-pages | grep gh-pages; then | ||
| git checkout gh-pages | ||
| else | ||
| echo "Creating new gh-pages branch" | ||
| git checkout --orphan gh-pages | ||
| git rm -rf . 2>/dev/null || true | ||
| echo "<html><body><h1>CV Resumes</h1></body></html>" > index.html | ||
| git add index.html | ||
| git config user.name "GitHub Actions" | ||
| git config user.email "actions@github.com" | ||
| git commit -m "Initialize gh-pages branch" | ||
| git push -u origin gh-pages | ||
| fi | ||
| - name: Detect changed web builds | ||
| id: detect | ||
| run: | | ||
| # Find all web build directories | ||
| builds=$(find resumes/customized/*/web -type d -maxdepth 0 2>/dev/null || true) | ||
| if [ -z "$builds" ]; then | ||
| echo "No web builds found" | ||
| echo "has_builds=false" >> $GITHUB_OUTPUT | ||
| exit 0 | ||
| fi | ||
| echo "Found web builds:" | ||
| echo "$builds" | ||
| echo "has_builds=true" >> $GITHUB_OUTPUT | ||
| echo "builds<<EOF" >> $GITHUB_OUTPUT | ||
| echo "$builds" >> $GITHUB_OUTPUT | ||
| echo "EOF" >> $GITHUB_OUTPUT | ||
| - name: Deploy web resumes | ||
| if: steps.detect.outputs.has_builds == 'true' | ||
| run: | | ||
| # Create cv directory if doesn't exist | ||
| mkdir -p cv-pages-repo/cv | ||
| # Process each build | ||
| while IFS= read -r build_dir; do | ||
| # Extract ID from path: resumes/customized/{id}/web | ||
| id=$(echo "$build_dir" | sed 's|resumes/customized/||;s|/web||') | ||
| echo "Processing: $id" | ||
| # Read metadata from resume_content.md | ||
| content_file="resumes/customized/$id/resume_content.md" | ||
| if [ ! -f "$content_file" ]; then | ||
| echo "Warning: $content_file not found, skipping" | ||
| continue | ||
| fi | ||
| # Extract company and role from metadata | ||
| company=$(grep "targetCompany:" "$content_file" | head -1 | sed 's/.*targetCompany: //' | tr '[:upper:]' '[:lower:]' | tr ' ' '_') | ||
| role=$(grep "targetRole:" "$content_file" | head -1 | sed 's/.*targetRole: //' | tr '[:upper:]' '[:lower:]' | tr ' ' '_') | ||
| # Generate hash from content for privacy/security | ||
| hash=$(sha256sum "$content_file" | cut -c1-4) | ||
| # Create semantic URL: date_company_hash | ||
| date=$(echo "$id" | cut -d'_' -f1-3) | ||
| semantic_id="${date}_${company}_${hash}" | ||
| echo "Semantic ID: $semantic_id" | ||
| # Copy build to CV-pages repo | ||
| target_dir="cv-pages-repo/cv/$semantic_id" | ||
| mkdir -p "$target_dir" | ||
| cp -r "$build_dir"/* "$target_dir/" | ||
| echo "Deployed to: /cv/$semantic_id" | ||
| # Update manifest | ||
| manifest="cv-pages-repo/cv/.manifest.json" | ||
| if [ ! -f "$manifest" ]; then | ||
| echo '{"version": "1.0", "deployments": []}' > "$manifest" | ||
| fi | ||
| # Add entry to manifest (simplified) | ||
| timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | ||
| echo "Updated manifest with deployment at $timestamp" | ||
| done <<< "${{ steps.detect.outputs.builds }}" | ||
| - name: Create robots.txt | ||
| if: steps.detect.outputs.has_builds == 'true' | ||
| run: | | ||
| cat > cv-pages-repo/cv/robots.txt << 'EOF' | ||
| User-agent: * | ||
| Disallow: /cv/ | ||
| EOF | ||
| - name: Commit and push to CV-pages | ||
| if: steps.detect.outputs.has_builds == 'true' | ||
| env: | ||
| CV_PAGES_TOKEN: ${{ secrets.CV_PAGES_TOKEN }} | ||
| run: | | ||
| cd cv-pages-repo | ||
| git config user.name "GitHub Actions" | ||
| git config user.email "actions@github.com" | ||
| git add . | ||
| git commit -m "$(cat <<'EOF' | ||
| Deploy web resumes [skip ci] | ||
| Automated deployment from datarian/CV@${{ github.sha }} | ||
| 🤖 Generated with GitHub Actions | ||
| EOF | ||
| )" || echo "No changes to commit" | ||
| git push https://x-access-token:${CV_PAGES_TOKEN}@github.com/datarian/CV-pages.git gh-pages | ||
| - name: Report deployment URLs | ||
| if: steps.detect.outputs.has_builds == 'true' | ||
| run: | | ||
| echo "## 🚀 Deployment Complete" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| echo "Web resumes deployed to private CV-pages repository:" >> $GITHUB_STEP_SUMMARY | ||
| echo "" >> $GITHUB_STEP_SUMMARY | ||
| # List all deployed URLs | ||
| for dir in cv-pages-repo/cv/*/; do | ||
| id=$(basename "$dir") | ||
| if [ "$id" != ".*" ] && [ "$id" != ".manifest.json" ]; then | ||
| echo "- https://datarian.github.io/CV-pages/cv/$id" >> $GITHUB_STEP_SUMMARY | ||
| fi | ||
| done | ||