]> git.mxchange.org Git - friendica-addons.git/blob - .drone.yml
82f5410ae238ffc2093971b72de55f591c9eda65
[friendica-addons.git] / .drone.yml
1 ---
2 kind: pipeline
3 type: docker
4 name: Check messages.po
5
6 clone:
7   disable: true
8
9 trigger:
10   event:
11     - pull_request
12
13 steps:
14   - name: clone friendica base
15     image: alpine/git
16     commands:
17       - git clone https://github.com/friendica/friendica.git .
18       - git checkout $DRONE_COMMIT_BRANCH
19   - name: clone friendica addon
20     image: alpine/git
21     commands:
22       - git clone $DRONE_REPO_LINK addon
23       - cd addon/
24       - git checkout $DRONE_COMMIT_BRANCH
25       - git fetch origin $DRONE_COMMIT_REF
26       - git merge $DRONE_COMMIT_SHA
27   - name: Run Xgettext for addons
28     image: friendicaci/transifex
29     commands:
30       - /xgettext-addon.sh
31   - name: Check update necessary
32     image: friendicaci/transifex
33     commands:
34       - /check-addons.sh
35 ---
36 kind: pipeline
37 type: docker
38 name: php-cs check
39
40 clone:
41   disable: true
42
43 trigger:
44   event:
45     - pull_request
46
47 steps:
48   - name: Clone friendica base
49     image: alpine/git
50     commands:
51       - git clone https://github.com/friendica/friendica.git .
52       - git checkout $DRONE_COMMIT_BRANCH
53   - name: Clone friendica addon
54     image: alpine/git
55     commands:
56       - git clone $DRONE_REPO_LINK addon
57       - cd addon/
58       - git checkout $DRONE_COMMIT_BRANCH
59       - git fetch origin $DRONE_COMMIT_REF
60       - git merge $DRONE_COMMIT_SHA
61   - name: Install dependencies
62     image: composer
63     commands:
64       - ./bin/composer.phar run cs:install
65   - name: Run coding standards check
66     image: friendicaci/php-cs
67     commands:
68       - cd addon/
69       - export CHANGED_FILES="$(git diff --name-status ${DRONE_COMMIT_BEFORE}..${DRONE_COMMIT_AFTER} | grep ^A | cut -f2 | sed -e "s/^/addon\\//")"
70       - cd ../
71       - /check-php-cs.sh
72 ---
73 kind: pipeline
74 type: docker
75 name: continuous-deployment
76
77 trigger:
78   repo:
79     - friendica/friendica-addons
80   branch:
81     - develop
82     - 20*-rc
83   event:
84     - push
85
86 node:
87   node: releaser # This prevents executing this pipeline at other servers than drone.friendi.ca
88
89 clone:
90   disable: true
91
92 steps:
93   - name: Clone friendica base
94     image: alpine/git
95     commands:
96       - git clone https://github.com/friendica/friendica.git .
97       - git checkout $DRONE_COMMIT_BRANCH
98   - name: Clone friendica addon
99     image: alpine/git
100     commands:
101       - git clone $DRONE_REPO_LINK addon
102       - cd addon/
103       - git checkout $DRONE_COMMIT_BRANCH
104       - git fetch origin $DRONE_COMMIT_REF
105       - git merge $DRONE_COMMIT_SHA
106   - name: Create artifacts
107     image: debian
108     commands:
109       - apt-get update
110       - apt-get install bzip2
111       - export VERSION="$(cat VERSION)"
112       - export RELEASE="friendica-addons-$VERSION"
113       - export ARTIFACT="$RELEASE.tar.gz"
114       - mkdir ./build
115       - # Create artifact for friendica-addons
116       - tar
117         --exclude='.tx'
118         --exclude='.git'
119         --exclude='.editorconfig'
120         --exclude='.gitattributes'
121         --exclude='.gitignore'
122         --exclude='.drone.yml'
123         --exclude='**/*/messages.po'
124         -cvzf ./build/$ARTIFACT addon/
125       - # calculate SHA256 checksum
126       - cd ./build
127       - sha256sum "$ARTIFACT" > "$ARTIFACT.sum256"
128       - ls -lh
129       - # output the sha256 sum for checking
130       - cat "$ARTIFACT.sum256"
131       - sha256sum "$ARTIFACT"
132   - name: Sign artifacts
133     image: plugins/gpgsign
134     settings:
135       key:
136         from_secret: gpg_key
137       passphrase:
138         from_secret: gpg_password
139       files:
140         - build/*
141       exclude:
142         - build/*.sum256
143       detach_sign: true
144   - name: Upload artifacts
145     image: alpine
146     environment:
147       LFTP_HOST:
148         from_secret: sftp_host
149       LFTP_USER:
150         from_secret: sftp_user
151       LFTP_KEY:
152         from_secret: ssh_key
153       LFTP_PORT: "22"
154       LFTP_SOURCE: "build"
155       LFTP_TARGET: "/http"
156     commands:
157       - apk add lftp openssh openssl
158       - touch drone.key
159       - chmod 400 drone.key
160       - echo "$LFTP_KEY" | openssl base64 -A -d > drone.key
161       - lftp -c "
162         set net:timeout 5;
163         set net:max-retries 2;
164         set net:reconnect-interval-base 5;
165         set sftp:auto-confirm true;
166         set sftp:connect-program 'ssh -q -a -x -i drone.key';
167         connect sftp://$LFTP_USER:@$LFTP_HOST:$LFTP_PORT;
168         cd $LFTP_TARGET;
169         mput $LFTP_SOURCE/*;
170         "
171       - rm drone.key
172
173 volumes:
174   - name: cache
175     host:
176       path: /tmp/drone-cache
177 ---
178 kind: pipeline
179 type: docker
180 name: release-deployment
181
182 trigger:
183   repo:
184     - friendica/friendica-addons
185   branch:
186     - stable
187   event:
188     - tag
189
190 node:
191   node: releaser # This prevents executing this pipeline at other servers than drone.friendi.ca
192
193 clone:
194   disable: true
195
196 steps:
197   - name: Clone friendica base
198     image: alpine/git
199     commands:
200       - git clone https://github.com/friendica/friendica.git .
201       - git checkout $DRONE_COMMIT_BRANCH
202   - name: Clone friendica addon
203     image: alpine/git
204     commands:
205       - git clone $DRONE_REPO_LINK addon
206       - cd addon/
207       - git checkout $DRONE_COMMIT_BRANCH
208       - git fetch origin $DRONE_COMMIT_REF
209       - git merge $DRONE_COMMIT_SHA
210   - name: Create artifacts
211     image: debian
212     commands:
213       - apt-get update
214       - apt-get install bzip2
215       - export VERSION="$(cat VERSION)"
216       - export RELEASE="friendica-addons-$VERSION"
217       - export ARTIFACT="$RELEASE.tar.gz"
218       - mkdir ./build
219       - # Create artifact for friendica-addons
220       - tar
221         --exclude='.tx'
222         --exclude='.git'
223         --exclude='.editorconfig'
224         --exclude='.gitattributes'
225         --exclude='.gitignore'
226         --exclude='.drone.yml'
227         --exclude='**/*/messages.po'
228         -cvzf ./build/$ARTIFACT addon/
229       - # calculate SHA256 checksum
230       - cd ./build
231       - sha256sum "$ARTIFACT" > "$ARTIFACT.sum256"
232       - ls -lh
233       - # output the sha256 sum for checking
234       - cat "$ARTIFACT.sum256"
235       - sha256sum "$ARTIFACT"
236   - name: Sign artifacts
237     image: plugins/gpgsign
238     settings:
239       key:
240         from_secret: gpg_key
241       passphrase:
242         from_secret: gpg_password
243       files:
244         - build/*
245       exclude:
246         - build/*.sum256
247       detach_sign: true
248   - name: Upload artifacts
249     image: alpine
250     environment:
251       LFTP_HOST:
252         from_secret: sftp_host
253       LFTP_USER:
254         from_secret: sftp_user
255       LFTP_KEY:
256         from_secret: ssh_key
257       LFTP_PORT: "22"
258       LFTP_SOURCE: "build"
259       LFTP_TARGET: "/http"
260     commands:
261       - apk add lftp openssh openssl
262       - touch drone.key
263       - chmod 400 drone.key
264       - echo "$LFTP_KEY" | openssl base64 -A -d > drone.key
265       - lftp -c "
266         set net:timeout 5;
267         set net:max-retries 2;
268         set net:reconnect-interval-base 5;
269         set sftp:auto-confirm true;
270         set sftp:connect-program 'ssh -q -a -x -i drone.key';
271         connect sftp://$LFTP_USER:@$LFTP_HOST:$LFTP_PORT;
272         cd $LFTP_TARGET;
273         mput $LFTP_SOURCE/*;
274         "
275       - rm drone.key
276
277 volumes:
278   - name: cache
279     host:
280       path: /tmp/drone-cache