diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 693144373..486cfd4ff 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -204,3 +204,38 @@ jobs: git config user.email github-actions@github.com git commit -am "Mirror evcc release" git push + + cleanup: + name: Delete Release Branch + needs: + - docker + - apt + runs-on: depot-ubuntu-24.04-arm + + permissions: + contents: write + + steps: + - uses: actions/checkout@v7 + with: + fetch-depth: 0 + persist-credentials: true + + # a bugfix release consumes its release branch, e.g. tag 0.313.1 is the tip + # of release/0.313.1. Feature releases have no such branch. + - env: + TAG: ${{ github.ref_name }} + run: | + branch="release/$TAG" + + head=$(git rev-parse --verify --quiet "origin/$branch") || { + echo "::notice::no $branch to delete" + exit 0 + } + + if [ "$head" != "$(git rev-parse "$TAG^{commit}")" ]; then + echo "::notice::$branch moved past $TAG, keeping it" + exit 0 + fi + + git push origin --delete "$branch" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e7e47bc0f..468fb64b5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -96,6 +96,10 @@ The commit is cherry-picked onto the branch of the next bugfix release, e.g. created at the newest tag of that line if it does not exist yet. Pass a branch name, `/backport release/0.312.2`, to service an older line. +Releasing a bugfix deletes its release branch, since the tag is the branch tip +and everything on it has shipped. A branch that received further backports after +the tag is kept. + ## Debugging in VS Code ### evcc Core