Update README and LaTeX Build File #1
This file contains 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: Update README and LaTeX Build File | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
update-files-and-rename-tex: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Extract repository name | |
run: echo "REPO_NAME=$(echo ${{ github.repository }} | sed 's|.*/||')" >> $GITHUB_ENV | |
- name: Update README | |
run: | | |
sed -i "1s/.*/# ${{ env.REPO_NAME }}/" README.md | |
sed -i "/Actions Status/c\[![Actions Status](https://github.com/${{ github.repository }}/workflows/CI/badge.svg)](https://github.com/${{ github.repository }})" README.md | |
- name: Update CMakeLists.txt with new LaTeX file name | |
run: | | |
sed -i "/project(/c\\project(${{ env.REPO_NAME }} NONE)" CMakeLists.txt | |
sed -i "0,/[^ ]*\.tex/s//${{ env.REPO_NAME }}.tex/" CMakeLists.txt | |
- name: Setup Git | |
run: | | |
git config --local user.email "${{ github.actor }}@users.noreply.github.com" | |
git config --local user.name "${{ github.actor }}" | |
- name: Commit and push if changed | |
run: | | |
git add README.md CMakeLists.txt | |
git diff --staged --quiet || git commit -m "Update README and LaTeX build configuration with correct repository name" | |
git push |