Merge remote-tracking branch 'origin/main' #4
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: Skripte ausführen und README aktualisieren | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| run-scripts: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Python einrichten | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.12' | |
| - name: Herztext.py ausführen | |
| working-directory: ./simple_py_program | |
| run: python Herztext.py | |
| - name: Sanduhr.py ausführen | |
| working-directory: ./simple_py_program | |
| run: python Sanduhr.py | |
| - name: Ausgaben in README einfügen | |
| run: | | |
| declare -A outputs | |
| outputs[HERZTEXT]="output_Herztext.md" | |
| outputs[SANDUHR]="output_Sanduhr.md" | |
| for key in "${!outputs[@]}"; do | |
| start="<!-- ${key}_OUTPUT_START -->" | |
| end="<!-- ${key}_OUTPUT_END -->" | |
| content=$(cat "${outputs[$key]}") | |
| awk -v s="$start" -v e="$end" -v r="$content" ' | |
| BEGIN {print_section=1} | |
| $0 ~ s {print; print r; print_section=0; next} | |
| $0 ~ e {print_section=1} | |
| print_section==1 {print} | |
| ' README.md > tmp && mv tmp README.md | |
| done | |
| - name: Änderungen committen | |
| run: | | |
| git config --global user.name "1501henify" | |
| git config --global user.email "[email protected]" | |
| git add README.md | |
| git commit -m "README mit aktuellen Ausgaben aktualisiert" || echo "No changes to commit" | |
| git push | |
| continue-on-error: true |