diff --git a/.gitea/workflows/godot-ci.yml b/.gitea/workflows/godot-ci.yml index fc77865..74a3317 100644 --- a/.gitea/workflows/godot-ci.yml +++ b/.gitea/workflows/godot-ci.yml @@ -28,6 +28,7 @@ jobs: apt-get install -y curl curl -fsSL https://deb.nodesource.com/setup_18.x | bash - apt-get install -y nodejs + - name: Checkout uses: https://gitea.com/actions/checkout@v4 with: @@ -36,25 +37,29 @@ jobs: run: | mkdir -v -p ~/.local/share/godot/export_templates/ mkdir -v -p ~/.config/ + + # This step updates the version_text.gd file with info about this build. + # If it isn't in the expected spot of game/scripts/version_text.gd, it will be skipped. - name: Populate Version Text run: | - - - PROJECT_NAME="${EXPORT_NAME}" - COMMIT_NUMBER="${GITHUB_RUN_NUMBER}" - BRANCH_NAME="${GITHUB_REF_NAME}" - SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-8) + VERSION_FILE="${PROJECT_PATH}/game/scripts/version_text.gd" + if [ -f "$VERSION_FILE" ]; then + PROJECT_NAME="${EXPORT_NAME}" + COMMIT_NUMBER="${GITHUB_RUN_NUMBER}" + BRANCH_NAME="${GITHUB_REF_NAME}" + SHORT_SHA=$(echo $GITHUB_SHA | cut -c1-8) - # Update the version_text.gd file with these values - sed -i "s/var project_name: String = \"X\"/var project_name: String = \"${PROJECT_NAME}\"/" ${PROJECT_PATH}/game/scripts/version_text.gd - sed -i "s/var commit_number: int = 0/var commit_number: int = ${COMMIT_NUMBER}/" ${PROJECT_PATH}/game/scripts/version_text.gd - sed -i "s/var branch_name: String = \"X\"/var branch_name: String = \"${BRANCH_NAME}\"/" ${PROJECT_PATH}/game/scripts/version_text.gd - sed -i "s/var short_sha: String = \"X\"/var short_sha: String = \"${SHORT_SHA}\"/" ${PROJECT_PATH}/game/scripts/version_text.gd - sed -i "s/var build_override: bool = false/var build_override: bool = true/" ${PROJECT_PATH}/game/scripts/version_text.gd + sed -i "s/var project_name: String = \"X\"/var project_name: String = \"${PROJECT_NAME}\"/" "$VERSION_FILE" + sed -i "s/var commit_number: int = 0/var commit_number: int = ${COMMIT_NUMBER}/" "$VERSION_FILE" + sed -i "s/var branch_name: String = \"X\"/var branch_name: String = \"${BRANCH_NAME}\"/" "$VERSION_FILE" + sed -i "s/var short_sha: String = \"X\"/var short_sha: String = \"${SHORT_SHA}\"/" "$VERSION_FILE" + sed -i "s/var build_override: bool = false/var build_override: bool = true/" "$VERSION_FILE" - # Show the updated file for verification - echo "Updated version_text.gd:" - cat ${PROJECT_PATH}/game/scripts/version_text.gd + echo "Updated version_text.gd:" + cat "$VERSION_FILE" + else + echo "version_text.gd not found at $VERSION_FILE, skipping." + fi - name: Windows Build run: |