|
| 1 | +name: docs.yml |
| 2 | +on: |
| 3 | + push: |
| 4 | + tags: |
| 5 | + - 'v*' |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + ref: |
| 9 | + type: string |
| 10 | + required: true |
| 11 | + description: Tag name or branch or ref to generate docs for |
| 12 | + |
| 13 | +jobs: |
| 14 | + generate-and-pr: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Checkout ember.js |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + repository: emberjs/ember.js |
| 21 | + path: ember.js |
| 22 | + ref: ${{ inputs.ref || github.ref_name }} |
| 23 | + |
| 24 | + - name: Checkout ember-jsonapi-docs |
| 25 | + uses: actions/checkout@v4 |
| 26 | + with: |
| 27 | + repository: kategengler/ember-jsonapi-docs |
| 28 | + path: ember-jsonapi-docs |
| 29 | + |
| 30 | + - name: Checkout ember-api-docs-data |
| 31 | + uses: actions/checkout@v4 |
| 32 | + with: |
| 33 | + repository: ember-learn/ember-api-docs-data |
| 34 | + path: ember-api-docs-data |
| 35 | + |
| 36 | + - name: Set up Node.js |
| 37 | + uses: actions/setup-node@v4 |
| 38 | + with: |
| 39 | + node-version: '20' |
| 40 | + cache: 'pnpm' |
| 41 | + |
| 42 | + - name: Install pnpm |
| 43 | + run: npm install -g pnpm |
| 44 | + |
| 45 | + - name: Install dependencies for ember-jsonapi-docs |
| 46 | + run: pnpm install |
| 47 | + working-directory: ember-jsonapi-docs |
| 48 | + |
| 49 | + - name: Install dependencies for ember-api-docs-data |
| 50 | + run: npm install |
| 51 | + working-directory: ember-api-docs-data |
| 52 | + |
| 53 | + - name: Get Ember version from package.json |
| 54 | + id: pkg |
| 55 | + run: | |
| 56 | + echo "version=$(jq -r .version package.json)" >> "$GITHUB_OUTPUT" |
| 57 | + working-directory: ember.js |
| 58 | + |
| 59 | + - name: Generate API docs |
| 60 | + run: pnpm run gen --project ember --version "${{ steps.pkg.outputs.version }}" |
| 61 | + working-directory: ember-jsonapi-docs |
| 62 | + |
| 63 | + - name: Commit changes |
| 64 | + run: | |
| 65 | + git config user.name "github-actions[bot]" |
| 66 | + git config user.email "github-actions[bot]@users.noreply.github.com" |
| 67 | + git checkout -b update-api-docs-${{ steps.pkg.outputs.version }} |
| 68 | + git add . |
| 69 | + git commit -m "Add docs for Ember ${{ steps.pkg.outputs.version }}" |
| 70 | + git push --set-upstream origin update-api-docs-${{ steps.pkg.outputs.version }} |
| 71 | + working-directory: ember-api-docs-data |
| 72 | + |
| 73 | + - name: Fix docs, commit, push |
| 74 | + run: | |
| 75 | + npm run fix:files |
| 76 | + git add . |
| 77 | + git commit -m "fix urls and rev-index for ember" |
| 78 | + git push --set-upstream origin update-api-docs-${{ steps.pkg.outputs.version }} |
| 79 | + working-directory: ember-api-docs-data |
| 80 | + |
| 81 | + - name: Create Pull Request |
| 82 | + uses: peter-evans/create-pull-request@v7 |
| 83 | + with: |
| 84 | + token: ${{ secrets.DOCS_GITHUB_TOKEN }} |
| 85 | + path: ember-api-docs-data |
| 86 | + commit-message: "Update Ember API docs for version ${{ steps.pkg.outputs.version }}" |
| 87 | + branch: update-api-docs-${{ steps.pkg.outputs.version }} |
| 88 | + title: "Update Ember API docs from workflow for version ${{ steps.pkg.outputs.version }}" |
| 89 | + body: "Automated update of API docs using ember-jsonapi-docs." |
0 commit comments