Skip to content

feat: basic template #3

feat: basic template

feat: basic template #3

Workflow file for this run

name: Setup project
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
permissions:
contents: write
jobs:
rename:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Ensure it's the initial commit
id: check_commit
run: |
# If commit message doesn't contain "Initial", set output to false
if [[ ! "${{ github.event.head_commit.message }}" =~ "Initial" ]]; then
echo "Commit message does not contain 'Initial'. Skipping further steps."
echo "skip=true" >> $GITHUB_ENV # Set environment variable to skip further steps
fi
- name: Rename files
if: env.skip != 'true'
run: |
REPO_NAME=$(basename ${GITHUB_REPOSITORY})
mv CarbonTemplateGUI/CarbonTemplateGUI.vcxproj CarbonTemplateGUI/${REPO_NAME}.vcxproj
mv CarbonTemplateGUI $REPO_NAME
mv CarbonTemplateGUI.sln $REPO_NAME.sln
- name: Find and replace
if: env.skip != 'true'
run: |
REPO_NAME=$(basename ${GITHUB_REPOSITORY})
REPO_OWNER=$(echo ${GITHUB_REPOSITORY} | cut -d '/' -f 1)
sed -i "s/CarbonTemplateGUI/${REPO_NAME}/g" $REPO_NAME/${REPO_NAME}.vcxproj
sed -i "s/CarbonTemplateGUI/${REPO_NAME}/g" $REPO_NAME.sln
sed -i "s/CarbonTemplateGUI/${REPO_NAME}/g" .gitattributes
sed -i "s/CarbonTemplateGUI/${REPO_NAME}/g" DebugInjector/DebugInjector.vcxproj
sed -i "s/REPONAME/${REPO_NAME}/g" manifest.json
sed -i "s/REPOOWNER/${REPO_OWNER}/g" manifest.json
sed -i "s/REPOOWNER/${REPO_OWNER}/g" manifest.json
sed -i "s/CarbonTemplateGUI/${REPO_NAME}/g" README.new.md
sed -i "s/BenMcAvoy, ScrappySM/${REPO_OWNER}/g" LICENSE
sed -i "s|REPOLINK|https://github.com/${GITHUB_REPOSITORY}|g" manifest.json
sed -i "s|RELEASES_LINK_URL|https://github.com/${GITHUB_REPOSITORY}/releases|g" README.new.md
- name: Update README to getting started
if: env.skip != 'true'
run: |
rm README.md
mv README.new.md README.md
- name: Delete this workflow
if: env.skip != 'true'
run: |
rm .github/workflows/setup.yml
- name: Commit changes
if: env.skip != 'true'
run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git add -A
git commit --amend --no-edit
git push --force