diff --git a/configs/default.kibot.yaml b/configs/default.kibot.yaml index 6ef36bd..9df96bb 100644 --- a/configs/default.kibot.yaml +++ b/configs/default.kibot.yaml @@ -23,6 +23,12 @@ preflight: - name: 'title' expand_kibot_patterns: true command: 'echo $KIBOT_PCB_NAME | rev | cut -d"/" -f1 | rev | cut -d"." -f1 ' + - name: 'DWN' + command: 'echo $DWN' + - name: 'CHK' + command: 'echo $CHK' + - name: 'APP' + command: 'echo $APP' check_zone_fills: true global: diff --git a/kibot-ci.yml b/kibot-ci.yml index d0507a8..0d2213b 100644 --- a/kibot-ci.yml +++ b/kibot-ci.yml @@ -148,7 +148,7 @@ image: - cat token_storage.json - cd $CI_PROJECT_DIR/Fabrication - 'SEARCH="bom.csv"' - - !reference [.commands, strip_tag] + - !reference [.commands, parse_commit] - !reference [.commands, get_files] - cd $CI_PROJECT_DIR - FAIL=0 @@ -184,7 +184,7 @@ image: # USE PRIVATE-TOKEN to upload from gitlab-ci git_tag: - - !reference [.commands, strip_tag] + - !reference [.commands, parse_commit] - | if [[ $GITLAB_CI == 'true' && $CI_COMMIT_BRANCH == "main" ]]; then echo "running git tag" @@ -236,7 +236,26 @@ image: done fi - strip_tag: + parse_commit: + - | + initials () { + echo "$(echo $1 | cut -d' ' -f1 | cut -c1-1)$(echo $1 | cut -d' ' -f2 | cut -c1-1)" + } + + str=$CI_COMMIT_MESSAGE + REV=$(echo "$str" | sed -n '1 p') + DWN=$(initials "$(echo "$str" | sed -n '3 p' | cut -d' ' -f1,2)") + CHK='' + APP='' + + while IFS= read -r line; do + if [[ $line == Rev* ]]; then + CHK=$(initials "$(echo $line | cut -d' ' -f2,3)") + fi + if [[ $line == App* ]]; then + APP=$(initials "$(echo $line | cut -d' ' -f2,3)") + fi + done <<<"$str" - TAG=$(echo ${CI_COMMIT_MESSAGE} | tr -d \\n) outputs_mech: @@ -335,7 +354,7 @@ upload_job: when: never # Do not run this job when a tag is created manually - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch script: - - !reference [.commands, strip_tag] + - !reference [.commands, parse_commit] - apt remove libcurl4 -y - apt-get update && apt-get -y install zip curl - | @@ -370,7 +389,7 @@ release_job: when: never # Do not run this job when a tag is created manually - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch script: - - !reference [.commands, strip_tag] + - !reference [.commands, parse_commit] - apk add jq curl - | echo "running release_job for $TAG"