Skip to content

Commit 2003b2a

Browse files
committed
Add CI step to build dispatch-cli deb file
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent eeca74a commit 2003b2a

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,3 +441,45 @@ jobs:
441441

442442
- name: Publish the Python distribution to PyPI
443443
uses: pypa/gh-action-pypi-publish@release/v1
444+
445+
build-deb:
446+
name: Build standalone executable
447+
# Build the standalone executable only on PRs and tags
448+
if: github.event_name == 'pull_request' || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
449+
runs-on: ubuntu-20.04
450+
steps:
451+
- name: Fetch sources
452+
uses: actions/checkout@v4
453+
with:
454+
submodules: true
455+
456+
- name: Set up Python
457+
uses: actions/setup-python@v5
458+
with:
459+
python-version: ${{ env.DEFAULT_PYTHON_VERSION }}
460+
cache: 'pip'
461+
462+
- name: Install required Python packages
463+
run: |
464+
python -m pip install -U pip
465+
python -m pip install -U pyinstaller fpm
466+
pip freeze
467+
468+
# Create stub to work around pyinstaller bug with __main__
469+
- name: Create stub
470+
run: echo -e "from frequenz.client.dispatch.__main__ import main\n\nmain()" > stub.py
471+
472+
- name: Build the standalone executable
473+
run: pyinstaller --onefile --name dispatch-cli --collect-all frequenz.client.dispatch stub.py
474+
475+
- name: Create deb package
476+
run: |
477+
git fetch --tags
478+
VERSION=$(git describe)
479+
fpm -s dir -t deb -n dispatch-cli -v ${VERSION} dist/dispatch-cli=/usr/bin/dispatch-cli
480+
481+
- name: Upload deb package
482+
uses: actions/upload-artifact@v4
483+
with:
484+
name: dispatch-cli
485+
path: '*.deb'

0 commit comments

Comments
 (0)