|
| 1 | +name: embedded-cluster-release-notes |
| 2 | +on: |
| 3 | + repository_dispatch: |
| 4 | + types: [embedded-cluster-release-notes] |
| 5 | + inputs: |
| 6 | + version: |
| 7 | + description: Embedded Cluster version |
| 8 | + required: true |
| 9 | + |
| 10 | +jobs: |
| 11 | + generate-release-notes-pr: |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Generate Release Notes |
| 17 | + id: release-notes |
| 18 | + env: |
| 19 | + EC_VERSION: ${{ github.event.client_payload.version }} |
| 20 | + uses: replicatedhq/release-notes-generator@main |
| 21 | + with: |
| 22 | + owner-repo: replicatedhq/embedded-cluster |
| 23 | + head: $EC_VERSION |
| 24 | + title: ${EC_VERSION#v} |
| 25 | + description: '' |
| 26 | + include-pr-links: false |
| 27 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 28 | + |
| 29 | + - name: Update Release Notes |
| 30 | + env: |
| 31 | + PATTERN: ".+RELEASE_NOTES_PLACEHOLDER.+" |
| 32 | + EC_VERSION: ${{ github.event.client_payload.version }} |
| 33 | + run: | |
| 34 | + # Extract EC version without v prefix if it exists |
| 35 | + EC_VERSION_CLEAN=${EC_VERSION#v} |
| 36 | + |
| 37 | + # Create the full release notes content |
| 38 | + cat > /tmp/release-notes.txt << EOF |
| 39 | + |
| 40 | + ## ${EC_VERSION_CLEAN} |
| 41 | + |
| 42 | + Released on $(date +'%B %-d, %Y') |
| 43 | + |
| 44 | + <!-- VERSION TABLE PLACEHOLDER |
| 45 | + Please manually replace this placeholder with a version table in the format: |
| 46 | + |
| 47 | + <table> |
| 48 | + <tr> |
| 49 | + <th>Version</th> |
| 50 | + <td id="center">X.Y.Z+k8s-1.XX</td> |
| 51 | + <td id="center">X.Y.Z+k8s-1.XX</td> |
| 52 | + </tr> |
| 53 | + <tr> |
| 54 | + <th>Kubernetes Version</th> |
| 55 | + <td id="center">1.XX.Y</td> |
| 56 | + <td id="center">1.XX.Y</td> |
| 57 | + </tr> |
| 58 | + <tr> |
| 59 | + <th>KOTS Version</th> |
| 60 | + <td id="center" colspan="2">1.XXX.Y</td> |
| 61 | + </tr> |
| 62 | + </table> |
| 63 | + --> |
| 64 | + |
| 65 | + ${{ steps.release-notes.outputs.release-notes }} |
| 66 | + EOF |
| 67 | + |
| 68 | + sed -i -E "/$PATTERN/r /tmp/release-notes.txt" docs/release-notes/rn-embedded-cluster.md |
| 69 | + rm -f /tmp/release-notes.txt |
| 70 | +
|
| 71 | + - name: Create Pull Request |
| 72 | + uses: peter-evans/create-pull-request@v7 |
| 73 | + id: cpr |
| 74 | + with: |
| 75 | + token: ${{ secrets.REPLICATED_GH_PAT }} |
| 76 | + commit-message: Embedded Cluster ${{ github.event.client_payload.version }} release notes |
| 77 | + title: Embedded Cluster ${{ github.event.client_payload.version }} release notes |
| 78 | + branch: automation/embedded-cluster-release-notes-${{ github.event.client_payload.version }} |
| 79 | + delete-branch: true |
| 80 | + base: "main" |
| 81 | + body: "Automated changes by the [embedded-cluster-release-notes](https://github.com/replicatedhq/replicated-docs/blob/main/.github/workflows/embedded-cluster-release-notes.yml) GitHub action. Please manually replace the version table placeholder." |
| 82 | + |
| 83 | + - name: Check outputs |
| 84 | + run: | |
| 85 | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" |
| 86 | + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" |
| 87 | +
|
| 88 | + - name: Slack Notification |
| 89 | + uses: slackapi/slack-github-action@v2.0.0 |
| 90 | + with: |
| 91 | + webhook: ${{ secrets.EMBEDDED_CLUSTER_RELEASE_NOTES_SLACK_WEBHOOK }} |
| 92 | + webhook-type: webhook-trigger |
| 93 | + payload: | |
| 94 | + version: "${{ github.event.client_payload.version }}" |
| 95 | + pull_request_url: "${{steps.cpr.outputs.pull-request-url}}" |
0 commit comments