-
Notifications
You must be signed in to change notification settings - Fork 91
131 lines (117 loc) · 5.95 KB
/
cd.yaml
File metadata and controls
131 lines (117 loc) · 5.95 KB
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
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_tanoconsulting_dot_com:
# testing: run this on every tag, not only proper releases
#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: create canary file
run: |
mkdir canary
touch canary/please_update.txt
- name: upload canary file to tanoconsulting.com
#if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, '4.') }}
uses: SamKirkland/FTP-Deploy-Action@v4.3.6
with:
server: ftp.tanoconsulting.com
username: ${{ secrets.ftp_tanoconsulting_com_user }}
password: ${{ secrets.ftp_tanoconsulting_com_password }}
#protocol: ftps
local-dir: ./canary/
#server-dir: ./
log-level: verbose