Create process-merge.yml #1
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: Process Merged Protocols | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| paths: ['staging/**/*.yml'] | ||
| jobs: | ||
| move-protocols: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - name: Process protocols | ||
| run: | | ||
| for staging_file in staging/**/*.yml; do | ||
| if [[ -f "$staging_file" ]]; then | ||
| # Extract paths | ||
| relative_path=${staging_file#staging/} | ||
| final_path="$relative_path" | ||
| archive_path="archive/$relative_path" | ||
| # Archive old version if exists | ||
| if [[ -f "$final_path" ]]; then | ||
| mkdir -p "$(dirname "$archive_path")" | ||
| mv "$final_path" "$archive_path" | ||
| fi | ||
| # Move new version to final location | ||
| mkdir -p "$(dirname "$final_path")" | ||
| mv "$staging_file" "$final_path" | ||
| fi | ||
| done | ||
| - name: Commit changes | ||
| run: | | ||
| git config user.name "GitHub Actions" | ||
| git config user.email "[email protected]" | ||
| git add . | ||
| git commit -m "Process merged protocols: archive old, publish new" || true | ||
| git push | ||