|
| 1 | +name: Update getting started guide |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: ['released'] |
| 6 | + pull_request: |
| 7 | + branches: ['main', 'release/**'] |
| 8 | + paths: |
| 9 | + # Run workflow on changes to the workflow definition itself to spot check |
| 10 | + # the core version update functionality. |
| 11 | + - '.github/workflows/update-getting-started-guide.yml' |
| 12 | + - 'scripts/update-getting-started-guide-version.sh' |
| 13 | + # Run workflow on changes to the getting started guide to validate |
| 14 | + # changes to the documentation do not break the update workflow. |
| 15 | + - 'docs/getting-started.md' |
| 16 | + |
| 17 | +jobs: |
| 18 | + test-update-version: |
| 19 | + if: github.event_name == 'pull_request' |
| 20 | + runs-on: ubuntu-20.04 |
| 21 | + |
| 22 | + permissions: |
| 23 | + contents: read |
| 24 | + pull-requests: read |
| 25 | + |
| 26 | + env: |
| 27 | + RELEASE_TAG: '' |
| 28 | + |
| 29 | + steps: |
| 30 | + - uses: actions/checkout@v4 |
| 31 | + with: |
| 32 | + sparse-checkout: | |
| 33 | + docs/getting-started.md |
| 34 | + scripts/update-getting-started-guide-version.sh |
| 35 | +
|
| 36 | + - name: Mock release tag on pull request |
| 37 | + run: echo "RELEASE_TAG=v0.0.0-${{ github.event.pull_request.number }}" >> $GITHUB_ENV |
| 38 | + |
| 39 | + - name: Test update getting started version |
| 40 | + run: bash scripts/update-getting-started-guide-version.sh --assert ${{ env.RELEASE_TAG }} |
| 41 | + |
| 42 | + update-version: |
| 43 | + if: github.event_name == 'release' |
| 44 | + runs-on: ubuntu-20.04 |
| 45 | + |
| 46 | + permissions: |
| 47 | + # Write permissions needed to create pull request. |
| 48 | + # Risk is mitigated by seperating jobs such that workflows |
| 49 | + # running with write permissions only use code from main. |
| 50 | + contents: write |
| 51 | + pull-requests: write |
| 52 | + |
| 53 | + steps: |
| 54 | + - uses: actions/checkout@v4 |
| 55 | + with: |
| 56 | + ref: main |
| 57 | + sparse-checkout: | |
| 58 | + docs/getting-started.md |
| 59 | + scripts/update-getting-started-guide-version.sh |
| 60 | +
|
| 61 | + - name: Update getting started version |
| 62 | + run: bash scripts/update-getting-started-guide-version.sh --verbose ${{ github.event.release.tag_name }} |
| 63 | + |
| 64 | + - name: Create PR |
| 65 | + uses: peter-evans/create-pull-request@v6 |
| 66 | + with: |
| 67 | + title: 'Update getting started to ${{ github.event.release.tag_name }}' |
| 68 | + commit-message: 'Update getting started to ${{ github.event.release.tag_name }}' |
| 69 | + body: | |
| 70 | + This PR must be closed and reopened manually to trigger automated checks. |
| 71 | +
|
| 72 | + Auto-generated by [create-pull-request](https://github.com/peter-evans/create-pull-request). |
| 73 | + labels: easy-to-review, automated-pr |
| 74 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 75 | + author: "GitHub <[email protected]>" |
| 76 | + signoff: true |
| 77 | + branch: 'create-pull-request/update-getting-started-version-to-${{ github.event.release.tag_name }}' |
| 78 | + base: main |
| 79 | + delete-branch: true |
0 commit comments