Skip to content

Commit a0e731f

Browse files
committed
Implementing CMS API documentation deployment
1 parent 2681c52 commit a0e731f

File tree

2 files changed

+88
-35
lines changed

2 files changed

+88
-35
lines changed

.drone.yml

Lines changed: 87 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,29 @@
11
---
22
kind: pipeline
3-
name: default
3+
name: deploy_static_assets
44

55
clone:
66

77
steps:
88
- name: prepare_package
99
image: joomlaprojects/docker-images:packager
1010
commands:
11-
- tar -cjf api-static.bz2 archived.html css/ images/ img/ js/ index.html results.html robots.txt 403.html 404.html .htaccess
11+
- mkdir build
12+
- cp -r -v archived.html css/ images/ img/ js/ index.html results.html robots.txt 403.html 404.html .htaccess ./build
1213

13-
- name: upload_package
14-
image: appleboy/drone-scp
15-
depends_on: [ prepare_package ]
16-
settings:
17-
host:
18-
from_secret: api_host
19-
user:
20-
from_secret: api_user
21-
key:
22-
from_secret: api_key
23-
port: 22
24-
target: /home/api/
25-
source: api-static.bz2
26-
27-
- name: extract_package
28-
image: appleboy/drone-ssh
29-
depends_on: [ upload_package ]
30-
settings:
31-
host:
32-
from_secret: update_host
33-
user:
34-
from_secret: update_user
35-
key:
36-
from_secret: update_key
37-
port: 22
38-
script:
39-
- tar jxf /home/api/api-static.bz2 -C /home/api/public_html
40-
- rm -rf /home/api/api-static.bz2
14+
- name: deploy_documentation
15+
image: debian:stable-slim
16+
environment:
17+
ssh_password:
18+
from_secret: ssh_password
19+
ssh_user:
20+
from_secret: ssh_user
21+
ssh_host:
22+
from_secret: ssh_host
23+
commands:
24+
- apt update && apt install -y rclone openssh-client
25+
- rclone config create api sftp host $ssh_host user $ssh_user pass $ssh_password port 22 use_insecure_cipher true disable_hashcheck true
26+
- rclone sync ./build/ api:/home/api/public_html -v --exclude "cms-2.5" --exclude "cms-3" --exclude "cms-4" --exclude "framework-1" --exclude "framework-2"
4127

4228
trigger:
4329
branch:
@@ -47,24 +33,91 @@ trigger:
4733

4834
---
4935
kind: pipeline
50-
name: build_v2_documentation
36+
name: build_documentation
5137

5238
clone:
5339

5440
steps:
41+
- name: parameter_check1
42+
image: debian:stable-slim
43+
commands:
44+
- |
45+
if [ "$JTYPE" = "framework" ]; then
46+
exit 0
47+
fi
48+
- echo "JTYPE parameter is missing. Allowed values [framework, cms]"
49+
- exit 1
50+
51+
- name: parameter_check2
52+
image: debian:stable-slim
53+
commands:
54+
- |
55+
if [ $JVERSION > 0 ]; then
56+
exit 0
57+
fi
58+
- echo 'JVERSION parameter is missing.'
59+
- exit 1
60+
5561
- name: prepare
5662
image: joomlaprojects/docker-images:php7.4
5763
commands:
5864
- composer install
59-
- vendor/bin/robo repos:checkout --fw=2
65+
- git config --global advice.detachedHead false
66+
- |
67+
if [ "$JTYPE" = "framework" ]; then
68+
vendor/bin/robo repos:checkout --fw=$JVERSION
69+
fi
70+
- |
71+
if [ "$JTYPE" = "cms" ]; then
72+
git clone https://github.com/joomla/joomla-cms.git ./repos/joomla-cms
73+
cd repos/joomla-cms
74+
git checkout tags/$JVERSION
75+
fi
6076
6177
- name: generate_documentation
6278
image: phpdoc/phpdoc
6379
commands:
64-
- phpdoc run -d ./repos/*/src -t ./build/api-docs/v2/ --template ./ --title "Joomla! Framework 2.x API" -i ./repos/string/src/phputf8 --setting=graphs.enabled=true
80+
- |
81+
if [ "$JTYPE" = "framework" ]; then
82+
phpdoc -d "./repos/*/src" -t "./build/framework-$JVERSION/" --template "./" --title "Joomla! Framework $JVERSION.x API" -i "./repos/string/src/phputf8" --setting=graphs.enabled=true
83+
fi
84+
- |
85+
if [ "$JTYPE" = "cms" ]; then
86+
export MINORVERSION=${JVERSION%.*}
87+
export MAJORVERSION=${MINORVERSION%.*}
88+
phpdoc -d "./repos/joomla-cms/libraries/src" -t "./build/cms-$MAJORVERSION/" --template "./" --title "Joomla! CMS $MINORVERSION.x API" --setting=graphs.enabled=true
89+
fi
90+
91+
- name: deploy_documentation
92+
image: debian:stable-slim
93+
environment:
94+
ssh_password:
95+
from_secret: ssh_password
96+
ssh_user:
97+
from_secret: ssh_user
98+
ssh_host:
99+
from_secret: ssh_host
100+
commands:
101+
- apt update && apt install -y rclone openssh-client
102+
- rclone config create api sftp host $ssh_host user $ssh_user pass $ssh_password port 22 use_insecure_cipher true disable_hashcheck true
103+
- |
104+
if [ "$JTYPE" = "framework" ]; then
105+
rclone sync ./build/framework-$JVERSION/ api:/home/api/public_html/framework-$JVERSION/ -v
106+
fi
107+
- |
108+
if [ "$JTYPE" = "cms" ]; then
109+
export MINORVERSION=${JVERSION%.*}
110+
export MAJORVERSION=${MINORVERSION%.*}
111+
rclone sync ./build/cms-$MAJORVERSION/ api:/home/api/public_html/cms-$MAJORVERSION/ -v
112+
fi
113+
-
114+
115+
trigger:
116+
event:
117+
- custom
65118

66119
---
67120
kind: signature
68-
hmac: 89007fb9d696ce7ddba323bd86e2957070075e74ab5f288d5a41bf5490060967
121+
hmac: 5691e654b6a8876f6ae2e42a636e49a092844e03fec6d35489dee33cc1a8fb9b
69122

70123
...

RoboFile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public function reposCheckout(ConsoleIO $io, $opts = ['fw' => '2'])
6464
}
6565

6666
chdir(__DIR__ . '/repos/' . $name);
67-
$tag = system('git tag -l "' . $opts['fw'] . '.*"');
67+
$tag = system('git tag -l --sort=creatordate "' . $opts['fw'] . '.*"');
6868
system("git checkout tags/$tag");
6969

7070
chdir(__DIR__ . '/');

0 commit comments

Comments
 (0)