update-from-data #60
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
| # File: .github/workflows/update-from-data.yml | |
| name: Update from Data Repository | |
| on: | |
| repository_dispatch: | |
| types: [update-from-data] | |
| jobs: | |
| update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout portfolio repository | |
| uses: actions/checkout@v3 | |
| - name: Checkout data repository | |
| uses: actions/checkout@v3 | |
| with: | |
| repository: korenmiklos/remote-theme | |
| path: temp-data | |
| - name: Update files from data repository | |
| run: | | |
| # List of files and folders to manage | |
| files_to_manage=( | |
| "_courses" | |
| "_data" | |
| "_posts" | |
| "_publications" | |
| "cv.md" | |
| "index.md" | |
| "project.md" | |
| "search-publications.json" | |
| # Add more files or folders as needed | |
| ) | |
| # Remove existing items using git rm | |
| for item in "${files_to_manage[@]}"; do | |
| if [ -e "$item" ]; then | |
| git rm -r "$item" | |
| echo "Removed $item from Git tracking" | |
| fi | |
| done | |
| # Copy items from temp-data | |
| for item in "${files_to_manage[@]}"; do | |
| if [ -e "temp-data/$item" ]; then | |
| cp -R "temp-data/$item" . | |
| git add "$item" | |
| echo "Copied and staged $item" | |
| else | |
| echo "Warning: $item not found in temp-data" | |
| fi | |
| done | |
| - name: Remove temp-data folder | |
| run: rm -rf temp-data | |
| - name: Commit and push changes | |
| run: | | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| git add . | |
| git commit -m "Update from data repository" || echo "No changes to commit" | |
| git push |