diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bc8729c182..5f0cdc3cef 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -58,7 +58,7 @@ workflow: # If running on any branch other than main, use the `aws-datacontracts - if: $CI_COMMIT_TAG variables: NEW_BRANCH: "release-c3" - VERSION: 'cat common/version.h | grep COMMA_VERSION | sed -e "s/[^0-9|.]//g"' + VERSION: 'cat common/version.h | grep COMMA_VERSION | sed -e "s/[^0-9|.]//g"' EXTRA_VERSION_IDENTIFIER: "-release" - when: always @@ -144,7 +144,7 @@ build: - echo "${GIT_ORIGIN}" - echo "Calling to publish [${CI_DIR}/publish.sh ${CI_PROJECT_DIR} ${OUTPUT_DIR} ${NEW_BRANCH} ${VERSION} ${GIT_ORIGIN}]" - git config --global --add safe.directory ${OUTPUT_DIR} - - $CI_DIR/publish.sh "${CI_PROJECT_DIR}" "${OUTPUT_DIR}" "${NEW_BRANCH}" "${VERSION}" "${GIT_ORIGIN}" + - $CI_DIR/publish.sh "${CI_PROJECT_DIR}" "${OUTPUT_DIR}" "${NEW_BRANCH}" "${VERSION}" "${GIT_ORIGIN}" "${EXTRA_VERSION_IDENTIFIER}" publish to private gitlab prebuilt: extends: ".publish_base" diff --git a/release/ci/publish.sh b/release/ci/publish.sh index 6fa2602858..d723782934 100755 --- a/release/ci/publish.sh +++ b/release/ci/publish.sh @@ -11,6 +11,7 @@ OUTPUT_DIR=$2 DEV_BRANCH=$3 VERSION=$4 GIT_ORIGIN=$5 +EXTRA_VERSION_IDENTIFIER=$6 # Check parameters if [ -z "$SOURCE_DIR" ] || [ -z "$OUTPUT_DIR" ]; then @@ -45,7 +46,7 @@ git init git rm -rf $OUTPUT_DIR/.git || true # Doing cleanup, but it might fail if the .git doesn't exist or not allowed to delete git remote remove origin || true # ensure cleanup git remote add origin $GIT_ORIGIN -#git push origin -d $DEV_BRANCH || true # Ensuring we delete the remote branch if it exists as we are wiping it out +#git push origin -d $DEV_BRANCH || true # Ensuring we delete the remote branch if it exists as we are wiping it out git fetch origin $DEV_BRANCH || (git checkout -b $DEV_BRANCH && git commit --allow-empty -m "sunnypilot v$VERSION release" && git push -u origin $DEV_BRANCH) echo "[-] committing version $VERSION T=$SECONDS" @@ -60,11 +61,16 @@ SP_VERSION=$(cat $SOURCE_DIR/common/version.h | awk -F\" '{print $2}') # Add built files to git git add -f . -git commit --amend -m "sunnypilot v$VERSION -version: sunnypilot v$SP_VERSION release -date: $DATETIME -master commit: $GIT_HASH -" +if [ "$EXTRA_VERSION_IDENTIFIER" = "-release" ] || [ "$EXTRA_VERSION_IDENTIFIER" = "-staging" ]; then + export VERSION=${VERSION%"$EXTRA_VERSION_IDENTIFIER"} + git commit --amend -m "sunnypilot v$VERSION" +else + git commit --amend -m "sunnypilot v$VERSION + version: sunnypilot v$SP_VERSION release + date: $DATETIME + master commit: $GIT_HASH + " +fi git branch -m $DEV_BRANCH # Push!