forked from espressif/idf-eclipse-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
190 lines (174 loc) · 5.82 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
stages:
- build
# - codesign
- private_deploy
- public_deploy
image: ${CI_DOCKER_REGISTRY}/esp32-ci-env
variables:
ARCHIVE_DIR: "dist"
ORIGIN_NAME: "com.espressif.idf.update-2.3.0-SNAPSHOT.zip"
.add_gh_key_remote: &add_gh_key_remote |
cit_add_ssh_key "${GH_PUSH_KEY}"
git remote remove github || true
git remote add github ${GH_PUSH_REPO}
# before_script:
# # Use CI Tools
# - curl -sSL ${CIT_LOADER_URL} | sh
# - source citools/import_functions
build:
stage: build
image: jimador/docker-jdk-8-maven-node
tags: ["build_maven", "build"]
artifacts:
paths:
- ${ARCHIVE_DIR}/
expire_in: 2 weeks
script:
# Use an unique name for the archive
- UNIQ_SUFFIX="$(git describe --tags --dirty --abbrev=8)"
- mkdir -p ${ARCHIVE_DIR} && echo "${UNIQ_SUFFIX}" > ${ARCHIVE_DIR}/uniq_suffix_value
- ARCHIVE_NAME=${ORIGIN_NAME/2.3.0-SNAPSHOT/$UNIQ_SUFFIX}
# build
- export JARSIGNER_KEYSTORE_B64=${JARSIGNER_REL_KEYSTORE_B64:-${JARSIGNER_DEV_KEYSTORE_B64}}
- export JARSIGNER_STOREPASS=${JARSIGNER_REL_STOREPASS:-${JARSIGNER_DEV_STOREPASS}}
- export JARSIGNER_ALIAS=${JARSIGNER_REL_ALIAS:-${JARSIGNER_DEV_ALIAS}}
- KEYSTORE_FILE="${PWD}/${JARSIGNER_KEYSTORE}"
- printf "%s" "${JARSIGNER_KEYSTORE_B64}" | base64 -d --ignore-garbage - > "${KEYSTORE_FILE}"
- mvn -e -X clean install -Djarsigner.keystore="${KEYSTORE_FILE}" -Djarsigner.alias="${JARSIGNER_ALIAS}" -Djarsigner.storepass="${JARSIGNER_STOREPASS}"
- rm -v "${KEYSTORE_FILE}"
- mkdir -p ${ARCHIVE_DIR} && mv -v releng/com.espressif.idf.update/target/${ORIGIN_NAME} ${ARCHIVE_DIR}/${ARCHIVE_NAME}
- ls -l ${ARCHIVE_DIR}
- export PRODUCTS_PATH=releng/com.espressif.idf.product/target/products/
- echo ${PRODUCTS_PATH}
# osx_code_sign:
# stage: codesign
# when: on_success
# tags:
# - macos_shell
# dependencies:
# - build
# script:
# - echo "code signing .app"
# - $PWD/tools/codesign.sh
# - $PWD/tools/notarize.sh
.upload_template: &upload_template
when: manual
image:
name: rclone/rclone:1
entrypoint: [""]
tags:
- deploy
dependencies:
- build
script:
# getting the corresponding unique suffix
- UNIQ_SUFFIX=$(cat ${ARCHIVE_DIR}/uniq_suffix_value)
- ARCHIVE_NAME=${ORIGIN_NAME/2.3.0-SNAPSHOT/$UNIQ_SUFFIX}
# upload archive
- cit_add_ssh_key "${SRV_KEY}"
- cd ${ARCHIVE_DIR}
- rclone --config=$RCLONE_CONFIG copy ${ARCHIVE_NAME} ${SRV_UPLOAD_PATH}
# upload directory
- UNIQ_DIR=${UNIQ_SUFFIX}
- mkdir ${UNIQ_DIR} && cd ${UNIQ_DIR} && unzip -q ../${ARCHIVE_NAME} && cd ..
- rclone --config=$RCLONE_CONFIG copy ${UNIQ_DIR} ${SRV_UPLOAD_PATH}
- ssh ${SRV_SERVER_SSH} "cd ${SRV_DIR} && ln -srnf ${UNIQ_DIR} ${SRV_LATEST_NAME}"
# Show info
- echo -e "\nAn archives was published there:\n\n${SRV_HTTP_URL}/${ARCHIVE_NAME}"
- echo -e "\n\n\nThe plugin was published there:\n\n${SRV_HTTP_URL}/${SRV_LATEST_NAME}"
.upload_ide: &upload_ide
when: manual
image:
name: rclone/rclone:1
entrypoint: [""]
tags:
- deploy
dependencies:
- build
script:
# getting the corresponding unique suffix
- UNIQ_SUFFIX=$(cat ${ARCHIVE_DIR}/uniq_suffix_value)
- WIN32_IDE_PATH= ${PRODUCTS_PATH}/Espressif-IDE-*-win32.win32.x86_64.zip
- MACOSX_IDE_PATH= ${PRODUCTS_PATH}/Espressif-IDE-*-macosx.cocoa.x86_64.tar.gz
- LINUX_IDE_PATH= ${PRODUCTS_PATH}/Espressif-IDE-*-linux.gtk.x86_64.tar.gz
# upload archive
- cit_add_ssh_key "${SRV_KEY}"
- rclone --config=$RCLONE_CONFIG copy ${WIN32_IDE_PATH} ${SRV_UPLOAD_PATH}
- rclone --config=$RCLONE_CONFIG copy ${MACOSX_IDE_PATH} ${SRV_UPLOAD_PATH}
- rclone --config=$RCLONE_CONFIG copy ${LINUX_IDE_PATH} ${SRV_UPLOAD_PATH}
# Show info
- echo -e "\nAn win32 Espressif-IDE was published there:\n\n${SRV_HTTP_URL}/${WIN32_IDE_PATH}"
- echo -e "\nAn macosx Espressif-IDE was published there:\n\n${SRV_HTTP_URL}/${MACOSX_IDE_PATH}"
- echo -e "\nAn linux Espressif-IDE was published there:\n\n${SRV_HTTP_URL}/${LINUX_IDE_PATH}"
internal_http:
<<: *upload_template
tags:
- deploy
stage: private_deploy
variables:
GIT_STRATEGY: none
SRV_KEY: ${INTRNL_KEY}
SRV_DIR: ${INTRNL_SERVER_CD_DIR}
SRV_SERVER_SSH: ${INTRNL_SERVER_SSH}
SRV_UPLOAD_PATH: ${INTRNL_SERVER_SSH}:${INTRNL_SERVER_CD_DIR}
SRV_LATEST_NAME: latest
SRV_HTTP_URL: ${INTRNL_SERVER_HTTP}
public_http:
<<: *upload_template
stage: public_deploy
only:
- /^v[0-9].*$/
variables:
GIT_STRATEGY: none
SRV_KEY: ${DL_KEY}
SRV_DIR: ${DL_SERVER_CD_DIR}
SRV_SERVER_SSH: ${DL_SERVER_SSH}
SRV_UPLOAD_PATH: ${DL_SERVER_SSH}:${DL_SERVER_CD_DIR}
SRV_LATEST_NAME: latest
SRV_HTTP_URL: ${DL_SERVER_HTTP}/${DL_SERVER_CD_DIR}
public_http_beta:
<<: *upload_template
stage: public_deploy
only:
- /^v[0-9].*$/
variables:
GIT_STRATEGY: none
SRV_KEY: ${DL_KEY}
SRV_DIR: ${DL_SERVER_CD_DIR}
SRV_SERVER_SSH: ${DL_SERVER_SSH}
SRV_UPLOAD_PATH: ${DL_SERVER_SSH}:${DL_SERVER_CD_DIR}
SRV_LATEST_NAME: beta
SRV_HTTP_URL: ${DL_SERVER_HTTP}/${DL_SERVER_CD_DIR}
publish_ide:
<<: *upload_ide
stage: public_deploy
only:
- /^v[0-9].*$/
variables:
GIT_STRATEGY: none
SRV_KEY: ${DL_KEY}
SRV_DIR: ${DL_SERVER_IDE_DIR}
SRV_SERVER_SSH: ${DL_SERVER_SSH}
SRV_UPLOAD_PATH: ${DL_SERVER_SSH}:${DL_SERVER_IDE_DIR}
SRV_LATEST_NAME: latest
SRV_HTTP_URL: ${DL_SERVER_HTTP}/${DL_SERVER_IDE_DIR}
.git_sync_template: &git_sync_template
stage: public_deploy
when: manual
tags:
- deploy
dependencies: []
push_master_to_github:
<<: *git_sync_template
only:
- master
script:
- *add_gh_key_remote
- git push github "${CI_COMMIT_SHA}:${CI_COMMIT_REF_NAME}"
push_tag_to_github:
<<: *git_sync_template
only:
- /^v[0-9].*$/
script:
- *add_gh_key_remote
- git push github "${CI_COMMIT_TAG}"