|
1 | | -# Release workflow for streamdeck-mcp |
2 | | -# |
3 | | -# How it works: |
4 | | -# 1. Create a git tag (e.g., v1.0.0) |
5 | | -# 2. Push the tag to trigger this workflow |
6 | | -# 3. Workflow builds and publishes to PyPI using Trusted Publishing |
7 | | -# |
8 | | -# PyPI Trusted Publishing: |
9 | | -# No API tokens needed! Configure at: |
10 | | -# https://pypi.org/manage/project/streamdeck-mcp/settings/publishing/ |
11 | | -# Add this repository as a trusted publisher. |
12 | | - |
13 | | -name: Release |
| 1 | +name: Release Please |
14 | 2 |
|
15 | 3 | on: |
16 | 4 | push: |
17 | | - tags: |
18 | | - - "v*" |
| 5 | + branches: |
| 6 | + - main |
| 7 | + workflow_dispatch: |
19 | 8 |
|
20 | 9 | permissions: |
21 | 10 | contents: write |
22 | | - id-token: write |
| 11 | + issues: write |
| 12 | + pull-requests: write |
23 | 13 |
|
24 | 14 | jobs: |
25 | | - test: |
| 15 | + release-please: |
| 16 | + name: Release Please |
| 17 | + runs-on: ubuntu-latest |
| 18 | + outputs: |
| 19 | + release_created: ${{ steps.release.outputs.release_created }} |
| 20 | + tag_name: ${{ steps.release.outputs.tag_name }} |
| 21 | + sha: ${{ steps.release.outputs.sha }} |
| 22 | + steps: |
| 23 | + - uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38 # v4 |
| 24 | + id: release |
| 25 | + with: |
| 26 | + token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }} |
| 27 | + config-file: release-please-config.json |
| 28 | + manifest-file: .release-please-manifest.json |
| 29 | + |
| 30 | + build-release: |
| 31 | + name: Build Release |
| 32 | + needs: release-please |
| 33 | + if: ${{ needs.release-please.outputs.release_created == 'true' }} |
26 | 34 | runs-on: ubuntu-latest |
| 35 | + permissions: |
| 36 | + contents: read |
27 | 37 | steps: |
28 | | - - uses: actions/checkout@v6 |
| 38 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 39 | + with: |
| 40 | + ref: ${{ needs.release-please.outputs.sha }} |
| 41 | + persist-credentials: false |
29 | 42 |
|
30 | | - - uses: actions/setup-python@v5 |
| 43 | + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 |
31 | 44 | with: |
32 | 45 | python-version: "3.11" |
33 | 46 |
|
34 | 47 | - name: Install uv |
35 | | - uses: astral-sh/setup-uv@v4 |
| 48 | + uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4 |
36 | 49 |
|
37 | 50 | - name: Install dependencies |
38 | 51 | run: | |
39 | 52 | uv venv |
40 | 53 | uv pip install -e ".[dev]" |
41 | 54 |
|
| 55 | + - name: Run linter |
| 56 | + run: uv run ruff check . |
| 57 | + |
42 | 58 | - name: Run tests |
43 | 59 | run: uv run pytest tests/ -v |
44 | 60 |
|
45 | | - build: |
46 | | - needs: test |
47 | | - runs-on: ubuntu-latest |
48 | | - steps: |
49 | | - - uses: actions/checkout@v6 |
50 | | - |
51 | | - - uses: actions/setup-python@v5 |
52 | | - with: |
53 | | - python-version: "3.11" |
54 | | - |
55 | | - - name: Install build dependencies |
56 | | - run: | |
57 | | - python -m pip install --upgrade pip |
58 | | - pip install build |
59 | | -
|
60 | 61 | - name: Build package |
61 | | - run: python -m build |
| 62 | + run: uv build --out-dir dist |
62 | 63 |
|
63 | 64 | - name: Upload artifacts |
64 | | - uses: actions/upload-artifact@v4 |
| 65 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 |
65 | 66 | with: |
66 | 67 | name: dist |
67 | 68 | path: dist/ |
68 | 69 |
|
69 | 70 | publish-pypi: |
70 | | - needs: build |
| 71 | + name: Publish to PyPI |
| 72 | + needs: build-release |
71 | 73 | runs-on: ubuntu-latest |
72 | 74 | environment: pypi |
73 | 75 | permissions: |
74 | 76 | id-token: write |
75 | 77 | steps: |
76 | 78 | - name: Download artifacts |
77 | | - uses: actions/download-artifact@v4 |
| 79 | + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 |
78 | 80 | with: |
79 | 81 | name: dist |
80 | 82 | path: dist/ |
81 | 83 |
|
82 | 84 | - name: Publish to PyPI |
83 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
84 | | - |
85 | | - create-release: |
86 | | - needs: publish-pypi |
| 85 | + uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1 |
| 86 | + with: |
| 87 | + skip-existing: true |
| 88 | + |
| 89 | + upload-release-artifacts: |
| 90 | + name: Upload Release Artifacts |
| 91 | + needs: |
| 92 | + - release-please |
| 93 | + - build-release |
| 94 | + if: ${{ needs.release-please.outputs.release_created == 'true' }} |
87 | 95 | runs-on: ubuntu-latest |
88 | 96 | permissions: |
89 | 97 | contents: write |
90 | 98 | steps: |
91 | | - - uses: actions/checkout@v6 |
| 99 | + - name: Download artifacts |
| 100 | + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 |
| 101 | + with: |
| 102 | + name: dist |
| 103 | + path: dist/ |
92 | 104 |
|
93 | | - - name: Create GitHub Release |
94 | | - uses: softprops/action-gh-release@v2 |
| 105 | + - name: Upload release artifacts |
| 106 | + uses: softprops/action-gh-release@153bb8e04406b158c6c84fc1615b65b24149a1fe # v2 |
95 | 107 | with: |
96 | | - generate_release_notes: true |
| 108 | + tag_name: ${{ needs.release-please.outputs.tag_name }} |
97 | 109 | files: | |
98 | | - profile_manager.py |
99 | | - profile_server.py |
100 | | - server.py |
101 | | - server.json |
| 110 | + dist/* |
| 111 | + fail_on_unmatched_files: true |
| 112 | + overwrite_files: true |
0 commit comments