|
| 1 | +name: Generate new docs |
| 2 | + |
| 3 | +on: |
| 4 | + workflow-dispatch: |
| 5 | + inputs: |
| 6 | + project: |
| 7 | + description: 'ember or ember-data' |
| 8 | + required: true |
| 9 | + version: |
| 10 | + description: 'The version to build, i.e. 3.20.0' |
| 11 | + required: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v2 |
| 19 | + |
| 20 | + - name: Clone the project repo |
| 21 | + run: | |
| 22 | + set -euo pipefail |
| 23 | + if [$INPUT_PROJECT -eq 'ember'] |
| 24 | + then |
| 25 | + git clone https://github.com/emberjs/ember.js |
| 26 | + cd ember.js |
| 27 | + git checkout "v$INPUT_VERSION" |
| 28 | + elif [$INPUT_PROJECT -eq 'ember-data'] |
| 29 | + then |
| 30 | + git clone https://github.com/emberjs/data |
| 31 | + cd data |
| 32 | + git checkout "v$INPUT_VERSION" |
| 33 | + else |
| 34 | + echo "Please specify either ember or ember-data for the project." |
| 35 | + fi |
| 36 | +
|
| 37 | + - name: Clone ember-api-docs-data |
| 38 | + run: git clone https://github.com/ember-learn/ember-api-docs-data |
| 39 | + |
| 40 | + - name: yarn install |
| 41 | + run: yarn install |
| 42 | + |
| 43 | + - name: Generate s3-docs |
| 44 | + working-directory: ember-jsonapi-docs |
| 45 | + run: yarn gen --project $INPUT_PROJECT --version $INPUT_VERSION |
| 46 | + |
| 47 | + - name: Generate json-docs |
| 48 | + working-directory: ember-jsonapi-docs |
| 49 | + run: yarn start --project $INPUT_PROJECT --version $INPUT_VERSION |
| 50 | + |
| 51 | + pull-request: |
| 52 | + name: Open a pull request in ember-api-docs-data |
| 53 | + needs: build |
| 54 | + runs-on: ubuntu-latest |
| 55 | + steps: |
| 56 | + - name: Set up Git |
| 57 | + run: | |
| 58 | + git config --global user.name "Tomster" |
| 59 | + git config --global user.email "[email protected]" |
| 60 | + - name: Set up SSH |
| 61 | + uses: webfactory/[email protected] |
| 62 | + with: |
| 63 | + ssh-private-key: ${{ secrets.GUIDES_SOURCE_DEPLOY_KEY }} |
| 64 | + |
| 65 | + - name: commit the changes |
| 66 | + run: cd .. && git add . && git commit -m "${INPUT_PROJECT}-${INPUT_VERSION}" |
| 67 | + |
| 68 | + - name: Push |
| 69 | + working-directory: ember-api-docs-data |
| 70 | + run: | |
| 71 | + set -euo pipefail |
| 72 | + IFS=$'\n\t' |
| 73 | + if git diff --exit-code HEAD~; then |
| 74 | + echo "Nothing to push" |
| 75 | + else |
| 76 | + git push -u origin "${INPUT_PROJECT}-${INPUT_VERSION}" |
| 77 | + fi |
0 commit comments