release-upgrade-notes.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. release_tags="$(git tag -l '3*.*.*' | grep -v -e '-' | sort -V)"
  47. if ! grep -qxF -- "${RELEASE_TAG}" <<< "${release_tags}"; then
  48. echo "Tag ${RELEASE_TAG} does not exist or is not a stable 3k release tag."
  49. exit 1
  50. fi
  51. while read -r tag; do
  52. if ! git show "refs/tags/${tag}:${NOTES_PATH}" > "${released_notes}" 2>/dev/null; then
  53. echo "Tag ${tag} has no ${NOTES_PATH}; skipping."
  54. else
  55. python3 -I scripts/release_upgrade_notes.py "${tag}" "${released_notes}" "${NOTES_PATH}"
  56. fi
  57. if [ "${tag}" = "${RELEASE_TAG}" ]; then
  58. break
  59. fi
  60. done <<< "${release_tags}"
  61. - name: Commit and push
  62. run: |
  63. if git diff --quiet -- "${NOTES_PATH}"; then
  64. echo "No changes to commit."
  65. exit 0
  66. fi
  67. git config user.name "github-actions[bot]"
  68. git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
  69. git add "${NOTES_PATH}"
  70. git commit -m "docs: label upgrade notes released up to ${RELEASE_TAG}"
  71. git push origin HEAD:next