New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document how to use phpDocumentor as github action #2242
Comments
@jaapio Hi, will this be added soon? |
@jaapio Hello, there is a minimal how to anywhere? |
A how-to would be much appreciated! I've tried to get this minimal example working: name: Run Tests
on:
push:
jobs:
run-tests:
runs-on: ubuntu-latest
strategy:
matrix:
php: [7.4]
name: PHP ${{ matrix.php }}
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Checkout repository
uses: actions/checkout@v2
- name: Generate API docs
uses: phpDocumentor/phpDocumentor@master
with:
args: -d src -t build/docs It does run on my local machine with
|
Hi, here is a minimal example 😄 name: phpDocumentor
on:
push:
branches: [ main ]
jobs:
phpdoc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run phpdoc
run: |
docker run --rm -v $(pwd):/data phpdoc/phpdoc:3 -d ./Src -t ./Docs
- name: git commit
run: |
git config user.name "GitHub Actions"
git config user.email ""
git add Docs/
git commit -m "Update phpdoc" || echo "No changes to commit"
git push |
It took me so long to figure this out that I can't really justify writing it all up right now, but here's another solution (using parts of @ryomo's example above) that builds this repo into this GitHub Pages site whenever there's a commit to It also persists phpDocumentor's cache directory between runs, which might help with larger repos. name: documentation
on:
push:
branches: [main]
# Allow running the workflow manually from the Actions tab
#workflow_dispatch:
# Allow GITHUB_TOKEN to deploy to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: pages
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure GitHub Pages
uses: actions/configure-pages@v1
- name: Cache phpDocumentor build files
id: phpdocumentor-cache
uses: actions/cache@v3
with:
path: .phpdoc/cache
key: ${{ runner.os }}-phpdocumentor-${{ github.sha }}
restore-keys: |
${{ runner.os }}-phpdocumentor-
- name: Build with phpDocumentor
run: docker run --rm --volume "$(pwd):/data" phpdoc/phpdoc:3 -vv --target docs --cache-folder .phpdoc/cache --template default
- name: Upload artifact to GitHub Pages
uses: actions/upload-pages-artifact@v1
with:
path: docs
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1 |
Fix added at #3695 Includes practical stuff and links to documentation. Should be good enough to merge today and improve tomorrow. |
In phpDocumentor's master branch a
action.yml
has been added. This opens new doors for projects to use phpDocumentor in their github workflows. The action is a currently a minimal setup. But no docs are available.We should add a page in our cookbook to explain how to use phpDocumentor in github actions.
The text was updated successfully, but these errors were encountered: