]> git.mxchange.org Git - friendica-addons.git/blob - .drone.yml
Merge pull request #1200 from tobiasd/20211030-ar
[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       - chmod 664 ./*
129       - ls -lh
130       - # output the sha256 sum for checking
131       - cat "$ARTIFACT.sum256"
132       - sha256sum "$ARTIFACT"
133   - name: Sign artifacts
134     image: plugins/gpgsign
135     settings:
136       key:
137         from_secret: gpg_key
138       passphrase:
139         from_secret: gpg_password
140       files:
141         - build/*
142       exclude:
143         - build/*.sum256
144       detach_sign: true
145   - name: Upload artifacts
146     image: alpine
147     environment:
148       LFTP_HOST:
149         from_secret: sftp_host
150       LFTP_USER:
151         from_secret: sftp_user
152       LFTP_KEY:
153         from_secret: ssh_key
154       LFTP_PORT: "22"
155       LFTP_SOURCE: "build"
156       LFTP_TARGET: "/http"
157     commands:
158       - apk add lftp openssh openssl
159       - touch drone.key
160       - chmod 400 drone.key
161       - echo "$LFTP_KEY" | openssl base64 -A -d > drone.key
162       - lftp -c "
163         set net:timeout 5;
164         set net:max-retries 2;
165         set net:reconnect-interval-base 5;
166         set sftp:auto-confirm true;
167         set sftp:connect-program 'ssh -q -a -x -i drone.key';
168         connect sftp://$LFTP_USER:@$LFTP_HOST:$LFTP_PORT;
169         cd $LFTP_TARGET;
170         mput $LFTP_SOURCE/*;
171         "
172       - rm drone.key
173
174 volumes:
175   - name: cache
176     host:
177       path: /tmp/drone-cache
178 ---
179 kind: pipeline
180 type: docker
181 name: release-deployment
182
183 trigger:
184   repo:
185     - friendica/friendica-addons
186   branch:
187     - stable
188   event:
189     - tag
190
191 node:
192   node: releaser # This prevents executing this pipeline at other servers than drone.friendi.ca
193
194 clone:
195   disable: true
196
197 steps:
198   - name: Clone friendica base
199     image: alpine/git
200     commands:
201       - git clone https://github.com/friendica/friendica.git .
202       - git checkout $DRONE_COMMIT_BRANCH
203   - name: Clone friendica addon
204     image: alpine/git
205     commands:
206       - git clone $DRONE_REPO_LINK addon
207       - cd addon/
208       - git checkout $DRONE_COMMIT_BRANCH
209       - git fetch origin $DRONE_COMMIT_REF
210       - git merge $DRONE_COMMIT_SHA
211   - name: Create artifacts
212     image: debian
213     commands:
214       - apt-get update
215       - apt-get install bzip2
216       - export VERSION="$(cat VERSION)"
217       - export RELEASE="friendica-addons-$VERSION"
218       - export ARTIFACT="$RELEASE.tar.gz"
219       - mkdir ./build
220       - # Create artifact for friendica-addons
221       - tar
222         --exclude='.tx'
223         --exclude='.git'
224         --exclude='.editorconfig'
225         --exclude='.gitattributes'
226         --exclude='.gitignore'
227         --exclude='.drone.yml'
228         --exclude='**/*/messages.po'
229         -cvzf ./build/$ARTIFACT addon/
230       - # calculate SHA256 checksum
231       - cd ./build
232       - sha256sum "$ARTIFACT" > "$ARTIFACT.sum256"
233       - chmod 664 ./*
234       - ls -lh
235       - # output the sha256 sum for checking
236       - cat "$ARTIFACT.sum256"
237       - sha256sum "$ARTIFACT"
238   - name: Sign artifacts
239     image: plugins/gpgsign
240     settings:
241       key:
242         from_secret: gpg_key
243       passphrase:
244         from_secret: gpg_password
245       files:
246         - build/*
247       exclude:
248         - build/*.sum256
249       detach_sign: true
250   - name: Upload artifacts
251     image: alpine
252     environment:
253       LFTP_HOST:
254         from_secret: sftp_host
255       LFTP_USER:
256         from_secret: sftp_user
257       LFTP_KEY:
258         from_secret: ssh_key
259       LFTP_PORT: "22"
260       LFTP_SOURCE: "build"
261       LFTP_TARGET: "/http"
262     commands:
263       - apk add lftp openssh openssl
264       - touch drone.key
265       - chmod 400 drone.key
266       - echo "$LFTP_KEY" | openssl base64 -A -d > drone.key
267       - lftp -c "
268         set net:timeout 5;
269         set net:max-retries 2;
270         set net:reconnect-interval-base 5;
271         set sftp:auto-confirm true;
272         set sftp:connect-program 'ssh -q -a -x -i drone.key';
273         connect sftp://$LFTP_USER:@$LFTP_HOST:$LFTP_PORT;
274         cd $LFTP_TARGET;
275         mput $LFTP_SOURCE/*;
276         "
277       - rm drone.key
278
279 volumes:
280   - name: cache
281     host:
282       path: /tmp/drone-cache