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