Update project structure #3
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: Configure New Repository | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
configure-new-repo: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.created && github.repository != 'TheDayIsMyEnemy/BlazorTemplate' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Rename files and folders | |
run: | | |
old_name='BlazorTemplate' | |
new_name=${{ github.event.repository.name }} | |
find . -maxdepth 2 -type d -name "$old_name*" -exec bash -c 'mv "{}" "$(echo "{}" | sed -e "s/'"${old_name}"'/'"${new_name}"'/")"' \; | |
find . -maxdepth 5 -type f \( -name '*.sln' -o -name '*.csproj' -o -name '*.cshtml' -o -name '*.razor' -o -name '*.cs' -o -name '*.md' \) -exec bash -c 'mv "{}" "$(echo "{}" | sed -e "s/'"${old_name}"'/'"${new_name}"'/")"' \; | |
find . -type f \( -name '*.sln' -o -name '*.csproj' -o -name '*.cshtml' -o -name '*.razor' -o -name '*.cs' -o -name '*.md' \) -exec sed -i "s/$old_name/$new_name/g" {} + | |
find . -type f \( -name '*.sln' \) -exec sed -i "s/TheDayIsMyEnemy/${{ github.actor }}/g" {} + | |
rm .github/workflows/template.yml | |
- name: Commit changes | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add -A | |
git commit -m "Update project structure" | |
git push |