forked from codeigniter4/CodeIgniter4
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (63 loc) · 1.91 KB
/
deploy-apidocs.yml
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
# When changes are pushed to the develop branch,
# build the current version of the API documentation
# with phpDocumentor and deploy it to codeigniter4/api.
name: Deploy API Documentation
on:
push:
branches:
- 'develop'
paths:
- 'system/**'
- '.github/workflows/deploy-apidocs.yml'
permissions:
contents: read
jobs:
build:
name: Deploy to api
permissions:
contents: write
if: github.repository == 'codeigniter4/CodeIgniter4'
runs-on: ubuntu-22.04
steps:
- name: Setup credentials
run: |
git config --global user.email "[email protected]"
git config --global user.name "${GITHUB_ACTOR}"
- name: Checkout source
uses: actions/checkout@v4
with:
path: source
- name: Checkout target
uses: actions/checkout@v4
with:
repository: codeigniter4/api
token: ${{ secrets.ACCESS_TOKEN }}
path: api
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
tools: phive
coverage: none
- name: Download latest phpDocumentor
working-directory: source
run: phive --no-progress install --trust-gpg-keys 8AC0BAA79732DD42 phpDocumentor
- name: Prepare API repo
working-directory: api
run: |
git reset --hard master
rm -rfv docs
mkdir --parents --verbose docs
- name: Build API in source repo
working-directory: source
run: |
php tools/phpDocumentor --ansi --verbose
cp -R ${GITHUB_WORKSPACE}/source/api/build/* ${GITHUB_WORKSPACE}/api/docs
- name: Deploy to API repo
working-directory: api
run: |
git add .
if ! git diff-index --quiet HEAD; then
git commit -m "Updated API for commit ${GITHUB_SHA}"
git push origin master
fi