-
Notifications
You must be signed in to change notification settings - Fork 94
168 lines (152 loc) · 7.89 KB
/
cd.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: CD
on:
# We limit this workflow to pushes of tags. No need to run on prs and on pushes to master
push:
#branches:
# - master
tags:
- '**'
jobs:
# we could try to split in 2 jobs: one for docs, running also on pushes to master, and one for releases, but the
# release one needs the asset from the docs one...
release:
if: ${{ startsWith(github.ref_name, '4.') && !(contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc')) }}
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # apparently required by tj-actions/changed-files
# these could be useful to update the generated docs on any pushes to master which have changes to docs sources
#- name: get changed files - manual
# id: changed-manual
# uses: tj-actions/changed-files@v35
# with:
# files: |
# doc/manual/**
#- name: get changed files - source
# id: changed-source
# uses: tj-actions/changed-files@v35
# with:
# files: |
# src/**
- name: set git credentials as user triggering the build
uses: fregante/setup-git-user@v1
# build and upload api docs
# (was: NB: this happens independently of releases!)
- name: generate and upload api docs
#if: ${{ steps.changed-source.outputs.any_changed == 'true' }}
run: |
chmod 755 ./doc/build/taskfile
./doc/build/taskfile setup_tools
./doc/build/taskfile build_api
mv doc/api .
git fetch
git checkout gh-pages
rm -rf doc-4/api
mv ./api doc-4
git add doc-4/api
git commit -m 'update api docs'
git push
git checkout ${{ github.ref_name }}
# build and upload manual
# (was: NB: this happens _also_ independently of releases!)
- name: generate and upload manual
#if: ${{ steps.changed-manual.outputs.any_changed == 'true' || (github.ref_type == 'tag' && startsWith(github.ref_name, '4.')) }}
run: |
chmod 755 ./doc/build/taskfile
./doc/build/taskfile setup_tools
./doc/build/taskfile build_manual
mv doc/manual/phpxmlrpc_manual.pdf .
git fetch
git checkout gh-pages
mv ./phpxmlrpc_manual.pdf doc-4
git add doc-4/phpxmlrpc_manual.pdf
git commit -m 'update pdf version of manual'
git push
cp doc-4/phpxmlrpc_manual.pdf .
git checkout ${{ github.ref_name }}
mv ./phpxmlrpc_manual.pdf doc/manual
# create release on github, with data from the NEWS file and add docs+demo artifacts
- name: create release assets
#if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, '4.') }}
run: |
tar -cvzf demofiles.tgz demo
tail -n+2 NEWS.md | sed '/## XML-RPC for PHP version/Q' >> announcement.txt
- name: create release on github
#if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, '4.') }}
uses: softprops/action-gh-release@v1
with:
body_path: announcement.txt
files: |
demofiles.tgz
doc/manual/phpxmlrpc_manual.pdf
# update github pages with release info
- name: update website with info about the latest release
#if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, '4.') }}
run: |
git fetch
git checkout gh-pages
sed -i 's|href="https://github.com/gggeek/phpxmlrpc/releases/tag/[^"]*"|href="https://github.com/gggeek/phpxmlrpc/releases/tag/${{ github.ref_name }}"|g' index.html
sed -i 's|<span class="evidence">.*</span>|<span class="evidence">${{ github.ref_name }}</span>|' index.html
sed -i "s|released on [^(]*|released on $(date '+%b. %-d, %Y') |" index.html
sed -i "s|Page last updated:.*|Page last updated: $(date +%Y/%-m/%-d)|" index.html
git add index.html
git commit -m 'update index page with latest release'
git push
git checkout ${{ github.ref_name }}
deploy_to_altervista:
if: ${{ startsWith(github.ref_name, '4.') && !(contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') || contains(github.ref_name, 'rc')) }}
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v3
# add the bits of jsxmlrpc that make the debugger nicer, so that they get uploaded to the demo server
- name: setup visualeditor for the debugger
#if: ${{ steps.changed-manual.outputs.any_changed == 'true' || (github.ref_type == 'tag' && startsWith(github.ref_name, '4.')) }}
run: |
chmod 755 ./taskfile
./taskfile setup_debugger_visualeditor
# upload the lib to gggeek.altervista.org via ftp
- name: upload lib to gggeek.altervista.org - src
#if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, '4.') }}
uses: SamKirkland/[email protected]
with:
server: ftp.gggeek.altervista.org
username: ${{ secrets.ftp_gggeek_altervista_org_user }}
password: ${{ secrets.ftp_gggeek_altervista_org_password }}
protocol: ftps
local-dir: ./src/
server-dir: src/
dangerous-clean-slate: true
- name: upload lib to gggeek.altervista.org - demo
#if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, '4.') }}
uses: SamKirkland/[email protected]
with:
server: ftp.gggeek.altervista.org
username: ${{ secrets.ftp_gggeek_altervista_org_user }}
password: ${{ secrets.ftp_gggeek_altervista_org_password }}
protocol: ftps
local-dir: ./demo/
server-dir: demo/
dangerous-clean-slate: true
# NB: codegen and discuss demos will not work anyway because /tmp is not writeable
exclude: |
**/*.pl
**/*.py
**/readme.md
**/codegen.php
**/discuss.php
**/testsuite.php
**/wrapper.php
- name: upload lib to gggeek.altervista.org - debugger
#if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, '4.') }}
uses: SamKirkland/[email protected]
with:
server: ftp.gggeek.altervista.org
username: ${{ secrets.ftp_gggeek_altervista_org_user }}
password: ${{ secrets.ftp_gggeek_altervista_org_password }}
protocol: ftps
local-dir: ./debugger/
server-dir: debugger/
dangerous-clean-slate: true