release-upgrade-notes.yml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. ---
  2. name: Release upgrade notes
  3. # Upgrade notes for merged but unreleased changes live under
  4. # "Next release (unreleased)" in upgrade_notes.adoc. When a 3k release is
  5. # tagged, move the notes that shipped in it under a heading for that version
  6. # on the next branch, which is where docs.olivetin.app is built from.
  7. on:
  8. push:
  9. tags:
  10. - '3*.*.*'
  11. - '!3*.*.*-*'
  12. workflow_dispatch:
  13. inputs:
  14. tag:
  15. description: 'Release tag to label upgrade notes with (eg 3000.23.0)'
  16. required: true
  17. permissions:
  18. contents: read
  19. # A run that is waiting must not be replaced by a later one, or the notes for
  20. # the earlier tag would be moved under the later version instead.
  21. concurrency:
  22. group: release-upgrade-notes
  23. cancel-in-progress: false
  24. queue: max
  25. jobs:
  26. label-upgrade-notes:
  27. runs-on: ubuntu-latest
  28. env:
  29. NOTES_PATH: docs/modules/ROOT/pages/upgrade/upgrade_notes.adoc
  30. RELEASE_TAG: ${{ inputs.tag || github.ref_name }}
  31. steps:
  32. - name: Checkout next
  33. uses: actions/checkout@v6
  34. with:
  35. ref: next
  36. fetch-depth: 0
  37. token: ${{ secrets.CONTAINER_TOKEN }}
  38. # Runs are queued in the order they start waiting, not in tag order, so
  39. # this run may start before the run for an earlier release. Every
  40. # release up to this one is processed oldest first, so a note always
  41. # moves under the first release that shipped it. Releases that already
  42. # have a section are skipped by the script.
  43. - name: Move released upgrade notes
  44. run: |
  45. released_notes="${RUNNER_TEMP}/upgrade_notes_released.adoc"
  46. if ! git rev-parse -q --verify "refs/tags/${RELEASE_TAG}" > /dev/null; then
  47. echo "Tag ${RELEASE_TAG} does not exist."
  48. exit 1
  49. fi
  50. git tag -l '3*.*.*' | grep -v -e '-' | sort -V | while read -r tag; do
  51. if ! git show "refs/tags/${tag}:${NOTES_PATH}" > "${released_notes}" 2>/dev/null; then
  52. echo "Tag ${tag} has no ${NOTES_PATH}; skipping."
  53. else
  54. python3 -I scripts/release_upgrade_notes.py "${tag}" "${released_notes}" "${NOTES_PATH}"
  55. fi
  56. if [ "${tag}" = "${RELEASE_TAG}" ]; then
  57. break
  58. fi
  59. done
  60. - name: Commit and push
  61. run: |
  62. if git diff --quiet -- "${NOTES_PATH}"; then
  63. echo "No changes to commit."
  64. exit 0
  65. fi
  66. git config user.name "github-actions[bot]"
  67. git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
  68. git add "${NOTES_PATH}"
  69. git commit -m "docs: label upgrade notes released up to ${RELEASE_TAG}"
  70. git push origin HEAD:next