]> git.mxchange.org Git - friendica-addons.git/blob - .drone.yml
Add stable releaser
[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: php-continous-package
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         -cvjf ./build/$ARTIFACT --transform "s,^addon,$RELEASE," addon/
125       - # calculate SHA256 checksum
126       - sha256sum ./build/$ARTIFACT > ./build/$ARTIFACT.sha256
127       - ls -lh ./build
128   - name: Upload artifacts
129     image: alpine
130     environment:
131       LFTP_HOST:
132         from_secret: sftp_host
133       LFTP_USER:
134         from_secret: sftp_user
135       LFTP_KEY:
136         from_secret: ssh_key
137       LFTP_PORT: "22"
138       LFTP_SOURCE: "build"
139       LFTP_TARGET: "/http"
140     commands:
141       - apk add lftp openssh openssl
142       - touch drone.key
143       - chmod 400 drone.key
144       - echo "$LFTP_KEY" | openssl base64 -A -d > drone.key
145       - lftp -c "
146         set net:timeout 5;
147         set net:max-retries 2;
148         set net:reconnect-interval-base 5;
149         set sftp:auto-confirm true;
150         set sftp:connect-program 'ssh -q -a -x -i drone.key';
151         connect sftp://$LFTP_USER:@$LFTP_HOST:$LFTP_PORT;
152         cd $LFTP_TARGET;
153         mput $LFTP_SOURCE/*;
154         "
155       - rm drone.key
156
157 volumes:
158   - name: cache
159     host:
160       path: /tmp/drone-cache
161 ---
162 kind: pipeline
163 type: docker
164 name: php-release-package
165
166 trigger:
167   repo:
168     - friendica/friendica-addons
169   branch:
170     - stable
171   event:
172     - tag
173
174 node:
175   node: releaser # This prevents executing this pipeline at other servers than drone.friendi.ca
176
177 clone:
178   disable: true
179
180 steps:
181   - name: Clone friendica base
182     image: alpine/git
183     commands:
184       - git clone https://github.com/friendica/friendica.git .
185       - git checkout $DRONE_COMMIT_BRANCH
186   - name: Clone friendica addon
187     image: alpine/git
188     commands:
189       - git clone $DRONE_REPO_LINK addon
190       - cd addon/
191       - git checkout $DRONE_COMMIT_BRANCH
192       - git fetch origin $DRONE_COMMIT_REF
193       - git merge $DRONE_COMMIT_SHA
194   - name: Create artifacts
195     image: debian
196     commands:
197       - apt-get update
198       - apt-get install bzip2
199       - export VERSION="$(cat VERSION)"
200       - export RELEASE="friendica-addons-$VERSION"
201       - export ARTIFACT="$RELEASE.tar.gz"
202       - mkdir ./build
203       - # Create artifact for friendica-addons
204       - tar
205         --exclude='.tx'
206         --exclude='.git'
207         --exclude='.editorconfig'
208         --exclude='.gitattributes'
209         --exclude='.gitignore'
210         --exclude='.drone.yml'
211         --exclude='**/*/messages.po'
212         -cvjf ./build/$ARTIFACT --transform "s,^addon,$RELEASE," addon/
213       - # calculate SHA256 checksum
214       - sha256sum ./build/$ARTIFACT > ./build/$ARTIFACT.sha256
215       - ls -lh ./build
216   - name: Upload artifacts
217     image: alpine
218     environment:
219       LFTP_HOST:
220         from_secret: sftp_host
221       LFTP_USER:
222         from_secret: sftp_user
223       LFTP_KEY:
224         from_secret: ssh_key
225       LFTP_PORT: "22"
226       LFTP_SOURCE: "build"
227       LFTP_TARGET: "/http"
228     commands:
229       - apk add lftp openssh openssl
230       - touch drone.key
231       - chmod 400 drone.key
232       - echo "$LFTP_KEY" | openssl base64 -A -d > drone.key
233       - lftp -c "
234         set net:timeout 5;
235         set net:max-retries 2;
236         set net:reconnect-interval-base 5;
237         set sftp:auto-confirm true;
238         set sftp:connect-program 'ssh -q -a -x -i drone.key';
239         connect sftp://$LFTP_USER:@$LFTP_HOST:$LFTP_PORT;
240         cd $LFTP_TARGET;
241         mput $LFTP_SOURCE/*;
242         "
243       - rm drone.key
244
245 volumes:
246   - name: cache
247     host:
248       path: /tmp/drone-cache