Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 11c3f09

Browse files
ci: replace TravisCI with GitHub Action
1 parent ca430e5 commit 11c3f09

File tree

8 files changed

+52945
-8934
lines changed

8 files changed

+52945
-8934
lines changed

‎.gitattributes‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*.xml text eol=lf
55
*.svg text eol=lf
66
*.yml text eol=lf
7+
*.toml text eol=lf
78
*.js text eol=lf
89
*.php text eol=lf diff=php
910
*.twig text eol=lf
@@ -16,7 +17,7 @@
1617
/.husky export-ignore
1718
/docs export-ignore
1819
/demo export-ignore
19-
/.travis.yml export-ignore
20+
/.netlify.toml export-ignore
2021
/phpdoc.dist.xml export-ignore
2122
/package-lock.json export-ignore
2223
/package.json export-ignore

‎.github/workflows/documentation.yml‎

Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,282 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- v1.x
8+
- main
9+
10+
pull_request:
11+
branches:
12+
- master
13+
- v1.x
14+
- main
15+
16+
release:
17+
types:
18+
- created
19+
20+
workflow_dispatch:
21+
22+
jobs:
23+
pre-build:
24+
name: Pre-build
25+
runs-on: ubuntu-22.04
26+
27+
outputs:
28+
should_skip: ${{ steps.skip_check.outputs.should_skip }}
29+
30+
steps:
31+
- name: Check Duplicate Actions
32+
id: skip_check
33+
uses: fkirc/skip-duplicate-actions@v5
34+
with:
35+
paths: |
36+
[
37+
".github/workflows/documentation.yml",
38+
"docs/**",
39+
"demo/**",
40+
"netlify.toml",
41+
"phpdoc.dist.xml"
42+
]
43+
do_not_skip: |
44+
[
45+
"release",
46+
"workflow_dispatch"
47+
]
48+
concurrent_skipping: "same_content_newer"
49+
50+
build:
51+
name: Build
52+
runs-on: ubuntu-22.04
53+
needs: pre-build
54+
if: ${{ needs.pre-build.outputs.should_skip != 'true' }}
55+
56+
steps:
57+
- uses: actions/checkout@v3
58+
59+
- name: "Distribution (cache)"
60+
uses: actions/cache@v3
61+
id: dist-cache
62+
with:
63+
path: dist/phpdoc-vuepress
64+
key: ${{ runner.os }}-dist-${{ github.sha }}
65+
66+
# Prepare PHP ------------------------------------------------------------
67+
- name: Setup PHP 7.3 environment
68+
if: ${{ steps.dist-cache.outputs.cache-hit != 'true' }}
69+
uses: shivammathur/setup-php@v2
70+
with:
71+
php-version: "7.3"
72+
73+
- name: Get Composer directories
74+
if: ${{ steps.dist-cache.outputs.cache-hit != 'true' }}
75+
id: composer-dirs
76+
run: |
77+
echo "::set-output name=cache::$(composer config cache-files-dir)"
78+
echo "::set-output name=home::$(composer config home --global)"
79+
- name: Composer (cache)
80+
if: ${{ steps.dist-cache.outputs.cache-hit != 'true' }}
81+
uses: actions/cache@v3
82+
with:
83+
path: ${{ steps.composer-dirs.outputs.cache }}
84+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
85+
restore-keys: |
86+
${{ runner.os }}-composer-
87+
- name: Prepare composer global
88+
if: ${{ steps.dist-cache.outputs.cache-hit != 'true' }}
89+
run: |
90+
composer global config minimum-stability dev
91+
composer global config prefer-stable true
92+
echo "${{ steps.composer-dirs.outputs.home }}/vendor/bin" >> $GITHUB_PATH
93+
94+
- name: Install dependencies
95+
if: ${{ steps.dist-cache.outputs.cache-hit != 'true' }}
96+
run: composer install --prefer-dist --no-progress
97+
98+
# Prepare npm ------------------------------------------------------------
99+
- name: Setup Node.js environment
100+
if: ${{ steps.dist-cache.outputs.cache-hit != 'true' }}
101+
uses: actions/setup-node@v3
102+
with:
103+
node-version: "16"
104+
105+
- name: Get npm cache directory
106+
if: ${{ steps.dist-cache.outputs.cache-hit != 'true' }}
107+
id: npm-cache-dir
108+
run: |
109+
echo "::set-output name=dir::$(npm config get cache)"
110+
- name: NPM (cache)
111+
if: ${{ steps.dist-cache.outputs.cache-hit != 'true' }}
112+
uses: actions/cache@v3
113+
id: npm-cache
114+
with:
115+
path: ${{ steps.npm-cache-dir.outputs.dir }}
116+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
117+
restore-keys: |
118+
${{ runner.os }}-node-
119+
- name: Install Node.js dependencies
120+
if: ${{ steps.dist-cache.outputs.cache-hit != 'true' }}
121+
run: npm install
122+
123+
# Build ------------------------------------------------------------------
124+
- name: Building PHP API documentation
125+
if: ${{ steps.dist-cache.outputs.cache-hit != 'true' }}
126+
run: composer build:api-docs
127+
128+
- name: Building VuePress documentation
129+
if: ${{ steps.dist-cache.outputs.cache-hit != 'true' }}
130+
run: npm run docs:build
131+
132+
# Pre-deploy
133+
pre-deploy:
134+
name: Pre-deploy
135+
runs-on: ubuntu-22.04
136+
137+
outputs:
138+
pr_number: ${{ steps.pr.outputs.number }}
139+
pr_title: ${{ steps.pr.outputs.title }}
140+
context: ${{ steps.context.outputs.value }}
141+
netlify_alias: ${{ steps.deploy_alias.outputs.value }}
142+
netlify_url: ${{ steps.deploy_url.outputs.value }}
143+
netlify_branch: ${{ steps.branch.outputs.value }}
144+
enabled: ${{ steps.can-deploy.outputs.value }}
145+
146+
steps:
147+
- uses: actions/checkout@v2
148+
149+
# - uses: jwalton/gh-find-current-pr@v1
150+
- name: Check PR number
151+
id: pr
152+
run: |
153+
echo "::set-output name=number::${{ github.event.number }}"
154+
- uses: rlespinasse/github-slug-action@v4
155+
- uses: haya14busa/action-cond@v1
156+
id: context
157+
name: Prepare Netlify environment
158+
with:
159+
cond: ${{ steps.pr.outputs.number == '' }}
160+
if_true: "netlify"
161+
if_false: "netlify-preview"
162+
163+
- uses: haya14busa/action-cond@v1
164+
id: can-deploy
165+
name: Detect branch is preview or is it enabled for production
166+
with:
167+
# Only allow previews and this branches: 'master'
168+
cond: ${{ steps.context.outputs.value == 'netlify-preview' || env.GITHUB_REF_SLUG == 'v1.x' }}
169+
if_true: true
170+
if_false: false
171+
172+
- uses: haya14busa/action-cond@v1
173+
id: branch
174+
name: Get the target branch
175+
with:
176+
cond: ${{ env.GITHUB_REF_SLUG == 'v1.x' }}
177+
if_true: ""
178+
if_false: ${{ env.GITHUB_REF_SLUG }}
179+
180+
- uses: haya14busa/action-cond@v1
181+
id: deploy_alias
182+
name: Prepare Netlify alias
183+
with:
184+
cond: ${{ steps.context.outputs.value == 'netlify' }}
185+
if_true: ${{ steps.branch.outputs.value }}
186+
if_false: deploy-preview-${{ steps.pr.outputs.number }}
187+
188+
- uses: haya14busa/action-cond@v1
189+
id: deploy_url
190+
name: Netlify URL
191+
with:
192+
cond: ${{ steps.context.outputs.value == 'netlify' }}
193+
if_true: https://phpdoc-vuepress.netlify.app
194+
if_false: https://${{ steps.deploy_alias.outputs.value }}--phpdoc-vuepress.netlify.app
195+
196+
# Deploy
197+
deploy:
198+
name: Deploy
199+
runs-on: ubuntu-22.04
200+
needs: [pre-deploy, build]
201+
if: ${{ needs.pre-deploy.outputs.enabled == 'true' }}
202+
203+
environment:
204+
name: ${{ needs.pre-deploy.outputs.context }}
205+
206+
steps:
207+
- uses: actions/checkout@v2
208+
209+
- name: "Distribution (cache)"
210+
uses: actions/cache@v3
211+
id: dist-cache
212+
with:
213+
path: dist/phpdoc-vuepress
214+
key: ${{ runner.os }}-dist-${{ github.sha }}
215+
216+
- name: Setup Node.js environment
217+
uses: actions/setup-node@v3
218+
with:
219+
node-version: "16"
220+
221+
- name: Get npm cache directory
222+
id: npm-cache-dir
223+
run: |
224+
echo "::set-output name=dir::$(npm config get cache)"
225+
- name: NPM (cache)
226+
uses: actions/cache@v3
227+
id: npm-cache
228+
with:
229+
path: ${{ steps.npm-cache-dir.outputs.dir }}
230+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
231+
restore-keys: |
232+
${{ runner.os }}-node-
233+
- uses: chrnorm/deployment-action@v1.2.0
234+
id: deployment
235+
with:
236+
environment: ${{ needs.pre-deploy.outputs.context }}
237+
token: "${{ github.token }}"
238+
target_url: ${{ needs.pre-deploy.outputs.netlify_url }}
239+
240+
- name: Deploy documentation (production)
241+
if: ${{ needs.pre-deploy.outputs.context == 'netlify' }}
242+
run: npx netlify deploy --prod --timeout=600 --message "Deployed on $(date)"
243+
env:
244+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
245+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
246+
247+
- name: Deploy documentation (preview)
248+
if: ${{ needs.pre-deploy.outputs.context == 'netlify-preview' }}
249+
run: npx netlify deploy --timeout=600 --message "Deployed preview on $(date)" --alias=$NETLIFY_ALIAS
250+
env:
251+
NETLIFY_ALIAS: ${{ needs.pre-deploy.outputs.netlify_alias }}
252+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
253+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
254+
255+
- name: Update deployment status (success)
256+
if: ${{ success() }}
257+
uses: chrnorm/deployment-status@v2
258+
with:
259+
token: "${{ github.token }}"
260+
state: "success"
261+
target_url: ${{ needs.pre-deploy.outputs.netlify_url }}
262+
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
263+
264+
- name: Update deployment status (failure)
265+
if: ${{ failure() }}
266+
uses: chrnorm/deployment-status@v2
267+
with:
268+
token: "${{ github.token }}"
269+
state: "failure"
270+
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
271+
272+
- name: Write PR comment
273+
if: ${{ success() && needs.pre-deploy.outputs.context == 'netlify-preview' }}
274+
id: pr-comment
275+
uses: peter-evans/create-or-update-comment@v2
276+
with:
277+
issue-number: ${{ needs.pre-deploy.outputs.pr_number }}
278+
body: |
279+
Netlify documentation preview is live! :sparkles:
280+
Built with commit ${{ github.sha }}
281+
${{ needs.pre-deploy.outputs.netlify_url }}
282+
reactions: "rocket"

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ output/
99
build/
1010
*.log
1111
npm-debug.log*
12+
13+
# Local Netlify folder
14+
.netlify

‎.travis.yml‎

Lines changed: 0 additions & 69 deletions
This file was deleted.

‎README.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
# PHPDoc-VuePress
44

5-
[![Travis Build Status](https://img.shields.io/travis/nelson6e65/phpdoc-vuepress/master.svg?logo=travis)](https://travis-ci.org/nelson6e65/phpdoc-vuepress)
6-
![PHP Versions](https://img.shields.io/travis/php-v/nelson6e65/phpdoc-vuepress.svg)
5+
![Documentation build](https://img.shields.io/github/actions/workflow/status/nelson6e65/phpdoc-vuepress/documentation.yml?label=docs)
6+
7+
![Packagist PHP Versions](https://img.shields.io/packagist/dependency-v/nelson6e65/phpdoc-vuepress/php)
78

89
[![GitHub release](https://img.shields.io/github/tag/nelson6e65/phpdoc-vuepress.svg)](https://github.com/nelson6e65/phpdoc-vuepress/tags)
910
[![Latest Version](https://img.shields.io/packagist/v/nelson6e65/phpdoc-vuepress.svg?label=stable)](https://packagist.org/packages/nelson6e65/phpdoc-vuepress)

‎composer.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
}
2424
},
2525
"require-dev": {
26-
"phpdocumentor/phpdocumentor": "^2.9",
26+
"phpdocumentor/phpdocumentor": "^2.9.1",
2727
"jms/serializer": "1.7.*"
2828
},
2929
"autoload-dev": {

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /