|
| 1 | +name: Generate Output |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'main' |
| 7 | + - '7.17' |
| 8 | + - '8.[0-9]+' |
| 9 | + |
| 10 | + # For debugging purposes: |
| 11 | + # pull_request: |
| 12 | + # types: [opened, synchronize, reopened] |
| 13 | + # branches: |
| 14 | + # - main |
| 15 | + |
| 16 | +concurrency: |
| 17 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 18 | + cancel-in-progress: false |
| 19 | + |
| 20 | +defaults: |
| 21 | + run: |
| 22 | + shell: bash |
| 23 | + |
| 24 | +jobs: |
| 25 | + build: |
| 26 | + runs-on: ubuntu-latest |
| 27 | + if: github.repository_owner == 'elastic' && github.actor != 'elasticmachine' |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@v3 |
| 31 | + with: |
| 32 | + token: ${{ secrets.PAT }} |
| 33 | + persist-credentials: true |
| 34 | + |
| 35 | + - name: Setup Node 16.x |
| 36 | + uses: actions/setup-node@v3 |
| 37 | + with: |
| 38 | + node-version: 16.x |
| 39 | + cache: npm |
| 40 | + cache-dependency-path: '**/package-lock.json' |
| 41 | + |
| 42 | + - name: Setup Dependencies |
| 43 | + run: | |
| 44 | + make setup |
| 45 | +
|
| 46 | + - name: Generate Output |
| 47 | + run: | |
| 48 | + make compile |
| 49 | + make generate |
| 50 | +
|
| 51 | + - name: Check for Changed Files |
| 52 | + id: changes |
| 53 | + run: | |
| 54 | + if [ -n "$(git status --porcelain)" ]; then |
| 55 | + echo "has-changes=1" >> $GITHUB_OUTPUT |
| 56 | + fi |
| 57 | +
|
| 58 | + - name: Set Git Identity |
| 59 | + if: steps.changes.outputs.has-changes == '1' |
| 60 | + run: |- |
| 61 | + git config --global user.email "[email protected]" |
| 62 | + git config --global user.name "Elastic Machine" |
| 63 | +
|
| 64 | + - name: Push Output |
| 65 | + if: steps.changes.outputs.has-changes == '1' |
| 66 | + run: | |
| 67 | + cd ./output |
| 68 | +
|
| 69 | + git add -A |
| 70 | + git commit -m "Update specification output" |
| 71 | +
|
| 72 | + git status |
| 73 | +
|
| 74 | + git push |
| 75 | +
|
| 76 | + # For debugging purposes: |
| 77 | + # - name: Push Output |
| 78 | + # if: steps.changes.outputs.has-changes == '1' |
| 79 | + # env: |
| 80 | + # BRANCH_NAME: output_${{ github.run_id }}_${{ github.run_attempt }} |
| 81 | + # run: | |
| 82 | + # cd ./output |
| 83 | + |
| 84 | + # git fetch |
| 85 | + # git switch main |
| 86 | + |
| 87 | + # git add -A |
| 88 | + # git commit -m "Update specification output" |
| 89 | + |
| 90 | + # git status |
| 91 | + |
| 92 | + # git push origin HEAD:refs/heads/${{ env.BRANCH_NAME }} |
0 commit comments