|
| 1 | +name: release |
| 2 | + |
| 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 |
| 13 | +on: |
| 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 |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: write |
| 23 | + |
| 24 | +jobs: |
| 25 | + release: |
| 26 | + runs-on: macos-latest |
| 27 | + |
| 28 | + steps: |
| 29 | + - name: Checkout main |
| 30 | + 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" |
| 39 | +
|
| 40 | + - name: Set up Python 3.11 |
| 41 | + uses: actions/setup-python@v5 |
| 42 | + with: |
| 43 | + python-version: '3.11' |
| 44 | + |
| 45 | + - name: Create venv and install dependencies |
| 46 | + run: | |
| 47 | + python3.11 -m venv venv |
| 48 | + venv/bin/pip install --upgrade pip |
| 49 | + venv/bin/pip install -r requirements.txt -r requirements-dev.txt |
| 50 | +
|
| 51 | + - name: Run tests (sanity check) |
| 52 | + run: venv/bin/pytest -v |
| 53 | + |
| 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 | +
|
| 68 | + - name: Build LinkBridge.app |
| 69 | + run: ./scripts/build_app.sh |
| 70 | + |
| 71 | + - name: Package .app as a zip with ditto |
| 72 | + run: | |
| 73 | + cd dist |
| 74 | + ditto -c -k --keepParent LinkBridge.app "LinkBridge-v${{ inputs.version }}.zip" |
| 75 | + ls -la |
| 76 | +
|
| 77 | + - name: Create draft GitHub Release |
| 78 | + env: |
| 79 | + GH_TOKEN: ${{ github.token }} |
| 80 | + run: | |
| 81 | + gh release create "v${{ inputs.version }}" \ |
| 82 | + --repo "${{ github.repository }}" \ |
| 83 | + --title "LinkBridge v${{ inputs.version }}" \ |
| 84 | + --generate-notes \ |
| 85 | + --draft \ |
| 86 | + "dist/LinkBridge-v${{ inputs.version }}.zip" |
0 commit comments