|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 2 | + |
| 3 | +name: PHPDOC |
| 4 | + |
| 5 | +# Controls when the action will run. |
| 6 | +on: |
| 7 | + # Triggers the workflow on push or pull request events but only for the master branch |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - master |
| 11 | + - maintaina-composerfixed |
| 12 | + - FRAMEWORK_6_0 |
| 13 | + # Allows you to run this workflow manually from the Actions tab |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 17 | +jobs: |
| 18 | + run: |
| 19 | + runs-on: ubuntu-20.04 |
| 20 | + steps: |
| 21 | + - name: Setup github ssh key |
| 22 | + run: mkdir -p ~/.ssh/ && ssh-keyscan -t rsa github.com > ~/.ssh/known_hosts |
| 23 | + - name: Setup uut dir |
| 24 | + run: | |
| 25 | + export REPO=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//") |
| 26 | + export UUT_DIR=$(pwd) |
| 27 | + export WORK_DIR=~ |
| 28 | + export BIN_DIR="${WORK_DIR}/bin" |
| 29 | + mkdir -p $BIN_DIR |
| 30 | + git config --global user.name "PHPDOC CI Job" |
| 31 | + git config --global user.email "[email protected]" |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v2 |
| 34 | + - name: Checkout Doc Dir |
| 35 | + uses: actions/checkout@v2 |
| 36 | + with: |
| 37 | + repository: maintaina/phpdoc |
| 38 | + token: ${{secrets.PHPDOC_TOKEN}} |
| 39 | + path: "phpdoc-git" |
| 40 | + - name: Setup PHP |
| 41 | + uses: shivammathur/setup-php@v2 |
| 42 | + with: |
| 43 | + php-version: 7.4 |
| 44 | + extensions: bcmath, ctype, curl, dom, gd, gettext, iconv, imagick, json, ldap, mbstring, mysql, opcache, openssl, pcntl, pdo, posix, redis, soap, sockets, sqlite, tokenizer, xmlwriter |
| 45 | + ini-values: post_max_size=512M, max_execution_time=360 |
| 46 | + coverage: xdebug |
| 47 | + tools: composer:v2 |
| 48 | + - name: Setup Github Token as composer credential |
| 49 | + run: composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }} |
| 50 | + - name: phpdocumentor run |
| 51 | + run: | |
| 52 | + export UUT_DIR=$(pwd) |
| 53 | + export REPO=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//") |
| 54 | + export WORK_DIR=/home/runner/ |
| 55 | + export BIN_DIR="${WORK_DIR}/bin" |
| 56 | + wget https://phpdoc.org/phpDocumentor.phar |
| 57 | + mkdir "${WORK_DIR}/phpdoc-out" |
| 58 | + mv phpDocumentor.phar $BIN_DIR/phpdocumentor |
| 59 | + chmod +x "${BIN_DIR}/phpdocumentor" |
| 60 | + echo "Creating UUT related dir in docu repo" |
| 61 | + mkdir -p $UUT_DIR/phpdoc-git/${GITHUB_REF##*/}/${REPO}/ |
| 62 | + ## Look into any of lib, src, app (if they exist) but not test, migration, bin, locale or script dirs |
| 63 | + $BIN_DIR/phpdocumentor -d $UUT_DIR/lib/ -d $UUT_DIR/src/ -d $UUT_DIR/app/ -t "${UUT_DIR}/phpdoc-git/${GITHUB_REF##*/}/${REPO}/" |
| 64 | + cd ${UUT_DIR}/phpdoc-git |
| 65 | + git add "${GITHUB_REF##*/}/${REPO}" |
| 66 | + php indexer.php ${GITHUB_REF##*/} $REPO |
| 67 | + git add index.html index.json |
| 68 | + git commit -m "Updated phpdoc for $GITHUB_REPOSITORY (${GITHUB_REF##*/} branch) from ci" |
| 69 | + git push |
0 commit comments