-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.gitlab-ci.yml
150 lines (139 loc) · 5.63 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
variables:
# As of Maven 3.3.0 instead of this you may define these options in `.mvn/maven.config` so the same config is used
# when running from the command line.
# `installAtEnd` and `deployAtEnd`are only effective with recent version of the corresponding plugins.
MAVEN_CLI_OPTS: "--batch-mode --errors --fail-at-end --show-version -Dtycho.localArtifacts=ignore -Dmaven.repo.local=.m2/repository -f build/pom.xml -s build/settings.xml"
VERSIONS: 0.6.0 0.5.0 0.4.0
# Cache downloaded dependencies and plugins between builds.
# To keep cache across branches add 'key: "$CI_JOB_NAME"'
cache:
key: "${CI_COMMIT_REF_SLUG}"
paths:
- .m2/repository
stages:
- build
- test
- analyze
- deploy
- post-deploy
build:
# build plugin using Maven
image: maven:3.9.4-eclipse-temurin-17
stage: build
script:
- VER=$( mvn -f build/pom.xml -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec )
- export VERSION=${VER/-SNAPSHOT/}
- echo Build ver ${VERSION}
- echo ${VERSION} > version.txt
- mvn ${MAVEN_CLI_OPTS} clean package -P build,site
artifacts:
expire_in: 4 weeks
when: always
paths:
- version.txt
- org.mard.dt.editing.repository/target/repository*.zip
- org.mard.dt.editing.repository/target/repository/*
- "*/target/results"
- "*/target/jacoco*.exec"
- "*/target/site/jacoco"
- "*/target/jacoco*"
.deploy:
stage: deploy
cache: {}
needs:
- build
before_script:
- export VERSION=$( cat version.txt )
- echo Project ver ${VERSION}
- ZIP_FILE_PATH=$( find ./org.mard.dt.editing.repository/target/ -type f -name "repository-*-SNAPSHOT.zip" )
script:
- echo "Need deploy"
deploy-current:
extends: .deploy
script:
- 'curl -f --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file "${ZIP_FILE_PATH}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/zip-p2/${VERSION}/repo.zip"'
only:
- master@marmyshev/edt-editing
deploy-manual:
extends: .deploy
script:
- 'curl -f --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file "${ZIP_FILE_PATH}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/zip-p2/${VERSION}/repo.zip"'
when: manual
deploy-latest:
extends: .deploy
script:
- 'curl -f --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file "${ZIP_FILE_PATH}" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/zip-p2/latest/repo.zip"'
only:
- master@marmyshev/edt-editing
pages:
extends: .deploy
stage: post-deploy
image:
name: pandoc/core
entrypoint: [""]
cache: {}
dependencies:
- build
script:
- apk add curl unzip
- mkdir -p ./public/update
- pandoc --from=markdown --to=html5 ${PWD}/README.md -o ${PWD}/public/index.html
- mv -f ./images ./public/
- mv -f "${ZIP_FILE_PATH}" ./public
- content_name="./public/update/compositeContent.xml"
- artifacts_name="./public/update/compositeArtifacts.xml"
- |
timestamp=$( date +%s%3 )
echo "<?xml version='1.0' encoding='UTF-8'?>" > $content_name
echo "<?compositeMetadataRepository version='1.0.0'?>" >> $content_name
echo "<repository name='1C:EDT Disable Editing Plugins'" >> $content_name
echo " type='org.eclipse.equinox.internal.p2.metadata.repository.CompositeMetadataRepository' version='1.0.0'>" >> $content_name
echo " <properties size='1'>" >> $content_name
echo " <property name='p2.timestamp' value='${timestamp}'/>" >> $content_name
echo " </properties>" >> $content_name
echo "<?xml version='1.0' encoding='UTF-8'?>" > $artifacts_name
echo "<?compositeArtifactRepository version='1.0.0'?>" >> $artifacts_name
echo "<repository name='1C:EDT Disable Editing Plugins'" >> $artifacts_name
echo " type='org.eclipse.equinox.internal.p2.artifact.repository.CompositeArtifactRepository' version='1.0.0'>" >> $artifacts_name
echo " <properties size='1'>" >> $artifacts_name
echo " <property name='p2.timestamp' value='${timestamp}'/>" >> $artifacts_name
echo " </properties>" >> $artifacts_name
- |
count=0
children=""
for VERSION in $VERSIONS
do
echo "Downloading ver: [${VERSION}]"
mkdir -p ./public/${VERSION}
curl -f -L --header "JOB-TOKEN: $CI_JOB_TOKEN" -o "${PWD}/public/${VERSION}/repo.zip" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/zip-p2/${VERSION}/repo.zip"
echo "- [${VERSION} P2-ZIP](../${VERSION}/repo.zip)" >> ${PWD}/update.md
echo "" >> ${PWD}/update.md
mkdir -p "${PWD}/public/update/${VERSION}"
unzip "${PWD}/public/${VERSION}/repo.zip" -d "${PWD}/public/update/${VERSION}"
count=$((count+1))
children="${children} <child location='${VERSION}'/>"$'\n'
done
echo " <children size='${count}'>" >> $content_name
echo " <children size='${count}'>" >> $artifacts_name
echo "${children}" >> $content_name
echo "${children}" >> $artifacts_name
- |
echo " </children>" >> $content_name
echo "</repository>" >> $content_name
echo " </children>" >> $artifacts_name
echo "</repository>" >> $artifacts_name
- p2index="./public/update/p2.index"
- |
echo "version=1" > $p2index
echo "metadata.repository.factory.order=compositeContent.xml,\!" >> $p2index
echo "artifact.repository.factory.order=compositeArtifacts.xml,\!" >> $p2index
- pandoc --from=markdown --to=html5 ${PWD}/update.md -o ${PWD}/public/update/index.html
environment:
name: pages
url: "${CI_PAGES_URL}"
artifacts:
paths:
- public
when: always
only:
- master@marmyshev/edt-editing