Build API Reference #62
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build API Reference | |
| on: | |
| schedule: | |
| - cron: '0 7 * * *' | |
| workflow_dispatch: | |
| env: | |
| DOCS_REPOSITORY: Paymenter/docs | |
| DOCS_BRANCH: v1 | |
| jobs: | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| extensions: bcmath, curl, gd, mbstring, mysql, openssl, pdo, tokenizer, xml, zip | |
| - name: Install dependencies | |
| run: composer install | |
| - name: Install Scramble PRO | |
| run: | | |
| composer config repositories.scramble-pro '{"type": "composer", "url": "https://satis.dedoc.co"}' | |
| composer config http-basic.satis.dedoc.co ${{ secrets.SCRAMBLE_USERNAME }} ${{ secrets.SCRAMBLE_KEY }} | |
| composer require dedoc/scramble-pro:^0.7.4 --dev | |
| - name: Checkout documentation repository | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.DOCS_API_TOKEN }} | |
| repository: ${{ env.DOCS_REPOSITORY }} | |
| ref: ${{ env.DOCS_BRANCH }} | |
| path: 'docs-repository' | |
| - name: Migrate database | |
| run: php artisan migrate --force --seed | |
| - name: Enable extensions with API routes (affiliates) | |
| run: | | |
| php artisan tinker --execute="DB::table('extensions')->insert(['name' => 'Affiliates', 'extension' => 'Affiliates', 'type' => 'other', 'enabled' => true])" | |
| - name: Build API docs | |
| run: php artisan scramble:export --path=docs-repository/public/openapi.json | |
| - name: Commit and push generated specification | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| commit_message: "Generated API specification from ${{ github.repository }}/${{ github.ref}}@${{ github.sha }}" | |
| repository: "docs-repository" |