Skip to content

Commit 0404ebd

Browse files
author
Максим Лясковский
committed
ci: trigger releases via workflow_dispatch with version bump
1 parent b5da70e commit 0404ebd

4 files changed

Lines changed: 106 additions & 15 deletions

File tree

.github/workflows/release.yml

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,41 @@
11
name: release
22

3+
# Trigger model: this workflow is triggered ONLY by manual dispatch.
4+
# Click "Run workflow" in the Actions tab on GitHub.com (or run
5+
# `gh workflow run release.yml -f version=2.0.1`
6+
# from the CLI), enter the new version, and the workflow will:
7+
# 1. Bump version files
8+
# 2. Commit + tag + push to main
9+
# 3. Run the test suite
10+
# 4. Build LinkBridge.app
11+
# 5. Package as a zip with ditto
12+
# 6. Create a draft GitHub Release with auto-generated notes
313
on:
4-
push:
5-
tags:
6-
- 'v*'
14+
workflow_dispatch:
15+
inputs:
16+
version:
17+
description: 'New version (e.g. 2.0.1, 2.1.0). Do NOT prefix with "v".'
18+
required: true
19+
type: string
720

821
permissions:
922
contents: write
1023

1124
jobs:
12-
build-and-release:
25+
release:
1326
runs-on: macos-latest
1427

1528
steps:
16-
- name: Checkout
29+
- name: Checkout main
1730
uses: actions/checkout@v4
31+
with:
32+
ref: main
33+
fetch-depth: 0 # full history so auto-generated release notes can diff against the previous tag
34+
35+
- name: Configure git identity
36+
run: |
37+
git config user.name "github-actions[bot]"
38+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
1839
1940
- name: Set up Python 3.11
2041
uses: actions/setup-python@v5
@@ -27,29 +48,39 @@ jobs:
2748
venv/bin/pip install --upgrade pip
2849
venv/bin/pip install -r requirements.txt -r requirements-dev.txt
2950
30-
- name: Run tests (sanity check before building)
51+
- name: Run tests (sanity check)
3152
run: venv/bin/pytest -v
3253

54+
- name: Bump version files
55+
run: venv/bin/bump-my-version replace --new-version "${{ inputs.version }}"
56+
57+
- name: Show diff after bump
58+
run: git diff
59+
60+
- name: Commit, tag, push
61+
run: |
62+
git add linkbridge/__init__.py setup.py
63+
git commit -m "chore: release v${{ inputs.version }}"
64+
git tag -a "v${{ inputs.version }}" -m "Release v${{ inputs.version }}"
65+
git push origin main
66+
git push origin "v${{ inputs.version }}"
67+
3368
- name: Build LinkBridge.app
3469
run: ./scripts/build_app.sh
3570

3671
- name: Package .app as a zip with ditto
3772
run: |
3873
cd dist
39-
ditto -c -k --keepParent LinkBridge.app "LinkBridge-${{ github.ref_name }}.zip"
74+
ditto -c -k --keepParent LinkBridge.app "LinkBridge-v${{ inputs.version }}.zip"
4075
ls -la
4176
4277
- name: Create draft GitHub Release
4378
env:
4479
GH_TOKEN: ${{ github.token }}
4580
run: |
46-
gh release create "${{ github.ref_name }}" \
81+
gh release create "v${{ inputs.version }}" \
4782
--repo "${{ github.repository }}" \
48-
--title "LinkBridge ${{ github.ref_name }}" \
49-
--notes "Automated build of ${{ github.ref_name }}.
50-
51-
The bundled \`.app\` is unsigned. On first launch macOS Gatekeeper will block it — right-click \`LinkBridge.app\` in Finder → **Open** → confirm the warning, then launch normally afterwards.
52-
53-
See the README for usage and the Rekordbox workflow notes." \
83+
--title "LinkBridge v${{ inputs.version }}" \
84+
--generate-notes \
5485
--draft \
55-
"dist/LinkBridge-${{ github.ref_name }}.zip"
86+
"dist/LinkBridge-v${{ inputs.version }}.zip"

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,40 @@ clocks / fake MIDI sinks — no hardware or Link peer required. The Link
201201
monitor and the menu bar app are validated by manual smoke tests against
202202
real hardware (the smoke procedure is documented in the project plan).
203203

204+
## Releasing a new version
205+
206+
Releases are cut by a single click in the **GitHub Actions** tab — no local
207+
commands or git tagging required.
208+
209+
1. Go to https://github.com/AnyByte/LinkBridge/actions/workflows/release.yml
210+
2. Click **Run workflow**
211+
3. Type the new version (e.g. `2.1.0`, no `v` prefix)
212+
4. Click **Run workflow**
213+
214+
The CI will then:
215+
216+
- Bump the version strings in `linkbridge/__init__.py` and `setup.py`
217+
- Commit and tag the bump on `main` (`v2.1.0`)
218+
- Run the test suite
219+
- Build `LinkBridge.app` and zip it via `ditto`
220+
- Create a **draft** GitHub Release with auto-generated notes (built from
221+
the conventional-commit history since the previous tag) and the
222+
`LinkBridge-v2.1.0.zip` attached
223+
224+
Find the draft release on the
225+
[Releases page](https://github.com/AnyByte/LinkBridge/releases), edit the
226+
notes if you want, then click **Publish release**.
227+
228+
You can also trigger the workflow from a terminal:
229+
230+
```bash
231+
gh workflow run release.yml -f version=2.1.0
232+
gh run watch # follow the build
233+
```
234+
235+
The release workflow uses [`bump-my-version`](https://github.com/callowayproject/bump-my-version)
236+
under the hood; the file list is in `pyproject.toml`.
237+
204238
## Regenerating the app icon
205239

206240
The icon source is `assets/icon.png` (1024×1024). To rebuild the

pyproject.toml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Project metadata used only by tooling — LinkBridge itself is built via setup.py + py2app.
2+
3+
[tool.bumpversion]
4+
current_version = "2.0.0"
5+
allow_dirty = true
6+
commit = false
7+
tag = false
8+
sign_tags = false
9+
parse = '(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(?:-(?P<pre>[A-Za-z0-9.]+))?'
10+
serialize = ["{major}.{minor}.{patch}-{pre}", "{major}.{minor}.{patch}"]
11+
12+
[[tool.bumpversion.files]]
13+
filename = "linkbridge/__init__.py"
14+
search = '__version__ = "{current_version}"'
15+
replace = '__version__ = "{new_version}"'
16+
17+
[[tool.bumpversion.files]]
18+
filename = "setup.py"
19+
search = '"CFBundleVersion": "{current_version}"'
20+
replace = '"CFBundleVersion": "{new_version}"'
21+
22+
[[tool.bumpversion.files]]
23+
filename = "setup.py"
24+
search = '"CFBundleShortVersionString": "{current_version}"'
25+
replace = '"CFBundleShortVersionString": "{new_version}"'

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
bump-my-version==1.3.0
12
py2app==0.28.10
23
pytest==9.0.3

0 commit comments

Comments
 (0)