11stages :
22 - build
3- - deploy
4- - release_draft
5- - release_submit
3+ - private_deploy
4+ - public_deploy
65
76image : ${CI_DOCKER_REGISTRY}/esp32-ci-env
87
@@ -14,22 +13,6 @@ before_script:
1413 # Use CI Tools
1514 - curl -sSL ${CIT_LOADER_URL} | sh
1615 - source citools/import_functions
17- # Use an unique name for the archive
18- - UNIQ_SUFFIX="g$(git describe --always --tags --dirty --abbrev=8)"
19- - ARCHIVE_NAME=${ORIGIN_NAME/SNAPSHOT/$UNIQ_SUFFIX}
20-
21- .add_gh_remote_key : &add_gh_remote_key |
22- cit_add_ssh_key "${GH_SSH_KEY}"
23- git remote remove gh || true
24- git remote add gh ${GH_PUSH_REPO}
25-
26- .release_tag_filter : &release_tag_filter
27- only :
28- - /^v[0-9].*$/
29-
30- .release_submit_action : &release_submit_action
31- when : manual
32- allow_failure : true
3316
3417build :
3518 stage : build
@@ -40,16 +23,67 @@ build:
4023 paths :
4124 - ${ARCHIVE_DIR}/
4225 expire_in : 2 weeks
43- variables :
44- GIT_STRATEGY : fetch
4526 script :
27+ # Use an unique name for the archive
28+ - UNIQ_SUFFIX="$(git describe --dirty --abbrev=8)"
29+ - mkdir -p ${ARCHIVE_DIR} && echo "${UNIQ_SUFFIX}" > ${ARCHIVE_DIR}/uniq_suffix_value
30+ - ARCHIVE_NAME=${ORIGIN_NAME/1.0.0-SNAPSHOT/$UNIQ_SUFFIX}
31+ # build
4632 - export JARSIGNER_KEYSTORE_B64=${JARSIGNER_REL_KEYSTORE_B64:-${JARSIGNER_DEV_KEYSTORE_B64}}
4733 - export JARSIGNER_STOREPASS=${JARSIGNER_REL_STOREPASS:-${JARSIGNER_DEV_STOREPASS}}
4834 - export JARSIGNER_ALIAS=${JARSIGNER_REL_ALIAS:-${JARSIGNER_DEV_ALIAS}}
4935 - KEYSTORE_FILE="${PWD}/${JARSIGNER_KEYSTORE}"
5036 - printf "%s" "${JARSIGNER_KEYSTORE_B64}" | base64 -d --ignore-garbage - > "${KEYSTORE_FILE}"
5137 - mvn -e -X clean install -Djarsigner.keystore="${KEYSTORE_FILE}" -Djarsigner.alias="${JARSIGNER_ALIAS}" -Djarsigner.storepass="${JARSIGNER_STOREPASS}"
5238 - rm -v "${KEYSTORE_FILE}"
53- - mkdir -p ${ARCHIVE_DIR}
54- - mv -v releng/com.espressif.idf.update/target/${ORIGIN_NAME} ${ARCHIVE_DIR}/${ARCHIVE_NAME}
39+ - mkdir -p ${ARCHIVE_DIR} && mv -v releng/com.espressif.idf.update/target/${ORIGIN_NAME} ${ARCHIVE_DIR}/${ARCHIVE_NAME}
5540 - ls -l ${ARCHIVE_DIR}
41+
42+ .upload_template : &upload_template
43+ when : manual
44+ tags :
45+ - deploy
46+ dependencies :
47+ - build
48+ script :
49+ # getting the corresponding unique suffix
50+ - UNIQ_SUFFIX=$(cat ${ARCHIVE_DIR}/uniq_suffix_value)
51+ - ARCHIVE_NAME=${ORIGIN_NAME/1.0.0-SNAPSHOT/$UNIQ_SUFFIX}
52+ # upload archive
53+ - cit_add_ssh_key "${SRV_KEY}"
54+ - cd ${ARCHIVE_DIR}
55+ - scp ${ARCHIVE_NAME} ${SRV_UPLOAD_PATH}
56+ # upload directory
57+ - UNIQ_DIR=${UNIQ_SUFFIX}
58+ - mkdir ${UNIQ_DIR} && cd ${UNIQ_DIR} && unzip -q ../${ARCHIVE_NAME} && cd ..
59+ - scp -r ${UNIQ_DIR} ${SRV_UPLOAD_PATH}
60+ - ssh ${SRV_SERVER_SSH} "cd ${SRV_DIR} && ln -srnf ${UNIQ_DIR} ${SRV_LATEST_NAME}"
61+ # Show info
62+ - echo -e "\nAn archives was published there:\n\n${SRV_HTTP_URL}/${ARCHIVE_NAME}"
63+ - echo -e "\n\n\nThe plugin was published there:\n\n${SRV_HTTP_URL}/${SRV_LATEST_NAME}"
64+
65+ internal_http :
66+ << : *upload_template
67+ stage : private_deploy
68+ variables :
69+ GIT_STRATEGY : none
70+ SRV_KEY : ${INTRNL_KEY}
71+ SRV_DIR : ${INTRNL_SERVER_CD_DIR}
72+ SRV_SERVER_SSH : ${INTRNL_SERVER_SSH}
73+ SRV_UPLOAD_PATH : ${INTRNL_SERVER_SSH}:${SRV_DIR}
74+ SRV_LATEST_NAME : latest
75+ SRV_HTTP_URL : ${INTRNL_SERVER_HTTP}
76+
77+ public_http :
78+ << : *upload_template
79+ stage : public_deploy
80+ only :
81+ - /^v[0-9].*$/
82+ variables :
83+ GIT_STRATEGY : none
84+ SRV_KEY : ${DL_KEY}
85+ SRV_DIR : " ${DL_SERVER_CD_DIR}"
86+ SRV_SERVER_SSH : ${DL_SERVER_SSH}
87+ SRV_UPLOAD_PATH : ${DL_SERVER_SSH}:${SRV_DIR}
88+ SRV_LATEST_NAME : latest
89+ SRV_HTTP_URL : ${DL_SERVER_HTTP}/${SRV_DIR}
0 commit comments