@@ -61,11 +61,23 @@ jobs:
6161 env :
6262 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6363
64+ - name : Use testing variables if still a template
65+ if : fromJson(steps.get_repo_meta.outputs.data).is_template == true
66+ run : |
67+ # This name is unsafe because it is not a valid C++ identifier
68+ echo "NEW_PROJECT=my-unsafe.project" >> $GITHUB_ENV
69+
70+ - name : Add safe replacement variable versions
71+ run : |
72+ # hyphens and dots in c++ identifiers are forbidden. Use underscores instead.
73+ NEW_SAFE_PROJECT=$(echo ${{ env.NEW_PROJECT }} | sed "s/-/_/g" | sed "s/\./_/g" )
74+ echo "NEW_SAFE_PROJECT=$NEW_SAFE_PROJECT" >> $GITHUB_ENV
75+
6476 # Rename all cpp_starter_project occurences to current repository and remove this workflow
6577 - name : Insert new org and project
6678 run : |
6779 # rename the CMake project to match the github project
68- sed -i "s/myproject/${{ github.event.repository.name }}/gi" CMakeLists.txt configured_files/config.hpp.in src/main.cpp
80+ sed -i "s/myproject/${{ env.NEW_SAFE_PROJECT }}/gi" CMakeLists.txt configured_files/config.hpp.in src/main.cpp
6981
7082 # Update URL placeholders for project
7183 sed -i "s|%%myurl%%|${{ fromJson(steps.get_repo_meta.outputs.data).html_url }}|gi" CMakeLists.txt
@@ -120,7 +132,8 @@ jobs:
120132 - name : Test simple configuration to make sure nothing broke
121133 run : |
122134 cmake -S . -B ./build -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE:STRING=${{ matrix.build_type }} -DENABLE_DEVELOPER_MODE:BOOL=${{ matrix.developer_mode }} -DOPT_ENABLE_COVERAGE:BOOL=OFF
123-
135+ # Build it because we may have broken something in the cpp/hpp files
136+ cmake --build build
124137
125138 - uses : EndBug/add-and-commit@v4
126139 # only commit and push if we are not a template project anymore!
0 commit comments