ci: Add ability to reupload after borked release

This commit is contained in:
Florian Bruhin 2025-10-24 14:33:24 +02:00
parent 0f320051e0
commit e208f5e121
2 changed files with 20 additions and 15 deletions

View File

@ -12,6 +12,7 @@ on:
- 'patch' - 'patch'
- 'minor' - 'minor'
- 'major' - 'major'
- 'reupload' # reupload last release
# FIXME do we want a possibility to do prereleases here? # FIXME do we want a possibility to do prereleases here?
python_version: python_version:
description: 'Python version' description: 'Python version'
@ -84,7 +85,7 @@ jobs:
gpg --import <<< "${{ secrets.QUTEBROWSER_BOT_GPGKEY }}" gpg --import <<< "${{ secrets.QUTEBROWSER_BOT_GPGKEY }}"
- name: Bump version - name: Bump version
id: bump id: bump
run: "tox -e update-version -- ${{ github.event.inputs.release_type }}" run: "tox -e update-version -- ${{ inputs.release_type }}"
- name: Check milestone - name: Check milestone
uses: actions/github-script@v8 uses: actions/github-script@v8
with: with:
@ -101,22 +102,24 @@ jobs:
core.setFailed(`Found open milestone ${milestone.title} with ${milestone.open_issues} open and ${milestone.closed_issues} closed issues!`); core.setFailed(`Found open milestone ${milestone.title} with ${milestone.open_issues} open and ${milestone.closed_issues} closed issues!`);
} }
- name: Push release commit/tag - name: Push release commit/tag
if: ${{ inputs.release_type != 'reupload' }}
run: | run: |
git push origin ${{ steps.find-branch.outputs.result }} git push origin ${{ steps.find-branch.outputs.result }}
git push origin v${{ steps.bump.outputs.version }} git push origin v${{ steps.bump.outputs.version }}
- name: Cherry-pick release commit - name: Cherry-pick release commit
if: ${{ github.event.inputs.release_type == 'patch' }} if: ${{ inputs.release_type == 'patch' }}
run: | run: |
git checkout main git checkout main
git cherry-pick -x v${{ steps.bump.outputs.version }} git cherry-pick -x v${{ steps.bump.outputs.version }}
git push origin main git push origin main
git checkout v${{ steps.bump.outputs.version_x }} git checkout v${{ steps.bump.outputs.version_x }}
- name: Create release branch - name: Create release branch
if: ${{ github.event.inputs.release_type != 'patch' }} if: ${{ inputs.release_type == 'minor' || inputs.release_type == 'major' }}
run: | run: |
git checkout -b v${{ steps.bump.outputs.version_x }} git checkout -b v${{ steps.bump.outputs.version_x }}
git push --set-upstream origin v${{ steps.bump.outputs.version_x }} git push --set-upstream origin v${{ steps.bump.outputs.version_x }}
- name: Create GitHub draft release - name: Create GitHub draft release
if: ${{ inputs.release_type != 'reupload' }}
id: create-release id: create-release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
@ -143,7 +146,7 @@ jobs:
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v6 uses: actions/setup-python@v6
with: with:
python-version: ${{ github.event.inputs.python_version }} python-version: ${{ inputs.python_version }}
- name: Import GPG Key - name: Import GPG Key
if: ${{ startsWith(matrix.os, 'ubuntu-') }} if: ${{ startsWith(matrix.os, 'ubuntu-') }}
run: | run: |

View File

@ -60,7 +60,7 @@ def show_commit():
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Update release version.") parser = argparse.ArgumentParser(description="Update release version.")
parser.add_argument('bump', action="store", parser.add_argument('bump', action="store",
choices=["major", "minor", "patch"], choices=["major", "minor", "patch", "dummy"],
help="Update release version") help="Update release version")
parser.add_argument('--commands', action="store_true", parser.add_argument('--commands', action="store_true",
help="Only show commands to run post-release.") help="Only show commands to run post-release.")
@ -70,7 +70,8 @@ if __name__ == "__main__":
if not args.commands: if not args.commands:
verify_branch(args.bump) verify_branch(args.bump)
bump_version(args.bump) if args.bump != "dummy":
bump_version(args.bump)
show_commit() show_commit()
import qutebrowser import qutebrowser
@ -87,15 +88,16 @@ if __name__ == "__main__":
print(f"Outputs for {version} written to GitHub Actions output file") print(f"Outputs for {version} written to GitHub Actions output file")
else: else:
print("Run the following commands to create a new release:") print("Run the following commands to create a new release:")
print("* git push origin; git push origin v{v}".format(v=version)) if args.bump != 'dummy':
if args.bump == 'patch': print("* git push origin; git push origin v{v}".format(v=version))
print("* git checkout main && git cherry-pick -x v{v} && " if args.bump == 'patch':
"git push origin".format(v=version)) print("* git checkout main && git cherry-pick -x v{v} && "
else: "git push origin".format(v=version))
print("* git branch v{x} v{v} && git push --set-upstream origin v{x}" else:
.format(v=version, x=version_x)) print("* git branch v{x} v{v} && git push --set-upstream origin v{x}"
print("* Create new release via GitHub (required to upload release " .format(v=version, x=version_x))
"artifacts)") print("* Create new release via GitHub (required to upload release "
"artifacts)")
print("* Linux: git fetch && git checkout v{v} && " print("* Linux: git fetch && git checkout v{v} && "
"tox -e build-release -- --upload" "tox -e build-release -- --upload"
.format(v=version)) .format(v=version))