]> git.mxchange.org Git - friendica-addons.git/blob - .woodpecker/.continuous-deployment.yml
Merge pull request #1235 from nupplaphil/bug/releaser
[friendica-addons.git] / .woodpecker / .continuous-deployment.yml
1 matrix:
2   include:
3     - PHP_MAJOR_VERSION: 7.4
4       PHP_VERSION: 7.4.18
5
6 platform: releaser/release # This prevents executing this pipeline at other servers than ci.friendi.ca
7
8 skip_clone: true
9
10 pipeline:
11   clone_friendica_base:
12     image: alpine/git
13     commands:
14       - git clone https://github.com/friendica/friendica.git .
15       - git checkout $CI_COMMIT_BRANCH
16     when:
17       repo: friendica/friendica-addons
18       branch: [ develop, '*-rc' ]
19       event: push
20   clone_friendica_addon:
21     image: alpine/git
22     commands:
23       - git clone $CI_REPO_LINK addon
24       - cd addon/
25       - git checkout $CI_COMMIT_BRANCH
26       - git fetch origin $CI_COMMIT_REF
27       - git merge $CI_COMMIT_SHA
28     when:
29       repo: friendica/friendica-addons
30       branch: [ develop, '*-rc' ]
31       event: push
32   restore_cache:
33     image: meltwater/drone-cache:dev
34     settings:
35       backend: "filesystem"
36       restore: true
37       cache_key: "{{ .Repo.Name }}_php${PHP_MAJOR_VERSION}_{{ arch }}_{{ os }}"
38       archive_format: "gzip"
39       mount:
40         - '.composer'
41     volumes:
42       - /tmp/drone-cache:/tmp/cache
43     when:
44       repo: friendica/friendica-addons
45       branch: [ develop, '*-rc' ]
46       event: push
47   composer_install:
48     image: friendicaci/php${PHP_MAJOR_VERSION}:php${PHP_VERSION}
49     commands:
50       - export COMPOSER_HOME=.composer
51       - composer validate
52       - composer install --no-dev --optimize-autoloader
53     volumes:
54       - /etc/hosts:/etc/hosts
55     when:
56       repo: friendica/friendica-addons
57       branch: [ develop, '*-rc' ]
58       event: push
59   create_artifacts:
60     image: debian
61     commands:
62       - apt-get update
63       - apt-get install bzip2
64       - mkdir ./build
65       - export VERSION="$(cat VERSION)"
66       - export RELEASE="friendica-addons-$VERSION"
67       - export ARTIFACT="$RELEASE.tar.gz"
68       - tar
69         --exclude='.tx'
70         --exclude='.git'
71         --exclude='.editorconfig'
72         --exclude='.gitattributes'
73         --exclude='.gitignore'
74         --exclude='.woodpecker'
75         --exclude='**/*/messages.po'
76         -cvzf ./build/$ARTIFACT addon/
77       - cd ./build
78       - sha256sum "$ARTIFACT" > "$ARTIFACT.sum256"
79       - chmod 664 ./*
80       - ls -lh
81       - cat "$ARTIFACT.sum256"
82       - sha256sum "$ARTIFACT"
83     when:
84       repo: friendica/friendica-addons
85       branch: [ develop, '*-rc' ]
86       event: push
87   sign_artifacts:
88     image: plugins/gpgsign
89     settings:
90       key:
91         from_secret: gpg_key
92       passphrase:
93         from_secret: gpg_password
94       files:
95         - build/*
96       exclude:
97         - build/*.sum256
98       detach_sign: true
99     when:
100       repo: friendica/friendica-addons
101       branch: [ develop, '*-rc' ]
102       event: push
103   upload_artifacts:
104     image: alpine
105     secrets:
106       - source: sftp_host
107         target: lftp_host
108       - source: sftp_user
109         target: lftp_user
110       - source: ssh_key
111         target: lftp_key
112     environment:
113       LFTP_PORT: "22"
114       LFTP_SOURCE: "build"
115       LFTP_TARGET: "/http"
116     volumes:
117       - /etc/hosts:/etc/hosts
118     commands:
119       - apk add lftp openssh openssl
120       - touch drone.key
121       - chmod 400 drone.key
122       - echo "$LFTP_KEY" | openssl base64 -A -d > drone.key
123       - lftp -c "
124         set net:timeout 5;
125         set net:max-retries 2;
126         set net:reconnect-interval-base 5;
127         set sftp:auto-confirm true;
128         set sftp:connect-program 'ssh -q -a -x -i drone.key';
129         connect sftp://$LFTP_USER:@$LFTP_HOST:$LFTP_PORT;
130         cd $LFTP_TARGET;
131         mput $LFTP_SOURCE/*;
132         "
133       - rm drone.key
134     when:
135       repo: friendica/friendica-addons
136       branch: [ develop, '*-rc' ]
137       event: push