Implemented parsing of commit message to find DWN, CHK, APP

This commit is contained in:
ac
2025-06-26 15:46:35 +10:00
parent 090bfacd2c
commit 4729aa8b86
2 changed files with 30 additions and 5 deletions

View File

@@ -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:

View File

@@ -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"