promote.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. # Promote the current main branch to a stable release.
  2. # This will not actually release anything, so you need to run the release workflow after this.
  3. #
  4. # IE if the current master version is 0.4.0-rc.7, this will create a PR to promote it to 0.4.0
  5. #
  6. # - update the version in the Cargo.toml to v0.4.0
  7. # - generate a v0.4 branch
  8. # - push the branch to the repository
  9. # - then bump 0.4.0-rc.1 to 0.5.0-rc.0
  10. #
  11. # This means main will never be a "stable" release, and we can always merge breaking changes to main
  12. # and backport them to the latest stable release
  13. #
  14. # This is configured to be ran manually, but could honestly just be a release workflow
  15. name: Promote main to stable branch
  16. on:
  17. workflow_dispatch:
  18. permissions:
  19. actions: write
  20. jobs:
  21. promote:
  22. runs-on: ubuntu-latest
  23. steps:
  24. - uses: actions/checkout@v4
  25. - name: Publish the next pre-release
  26. run: |
  27. git config --global user.email "github-actions[bot]@users.noreply.github.com"
  28. git config --global user.name "github-actions[bot]"
  29. # go from eg 0.4.0-rc.7 to 0.4.0, committing the change
  30. cargo workspaces version -y minor
  31. # create a new branch for the release
  32. RELEASE_BRANCH=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
  33. RELEASE_BRANCH=v$(echo $RELEASE_BRANCH | sed 's/\.[0-9]*$//')
  34. git branch $RELEASE_BRANCH
  35. # go from 0.4.0 to 0.5.0-rc.0
  36. cargo workspaces version -y preminor --pre-id rc
  37. # push the new branch to the repository
  38. git push origin $RELEASE_BRANCH
  39. # push the new version to the repository
  40. git push origin main