Skip to content

Powermem CLI Cases #442

Powermem CLI Cases

Powermem CLI Cases #442

Workflow file for this run

name: Build Package
on:
push:
branches: [main, develop]
tags:
- 'v*'
pull_request:
branches: [main, develop]
workflow_dispatch:
inputs:
python_version:
description: 'Python version to build with'
required: false
default: '3.10'
type: choice
options:
- '3.10'
- '3.11'
- '3.12'
jobs:
build-dashboard:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 10
- name: Build Dashboard
run: |
cd dashboard
pnpm install
pnpm build
- name: Upload dashboard dist
uses: actions/upload-artifact@v4
with:
name: dashboard-dist
path: dashboard/dist/
build:
runs-on: ubuntu-latest
needs: build-dashboard
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download dashboard artifact
uses: actions/download-artifact@v4
with:
name: dashboard-dist
path: dashboard-dist
- name: Inject Dashboard into package
run: |
mkdir -p src/server/dashboard
cp -r dashboard-dist/* src/server/dashboard/
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
pip install --upgrade setuptools wheel
- name: Install build tools
run: |
pip install build twine
- name: Clean previous builds
run: |
rm -rf dist/ build/ *.egg-info/
- name: Build package
run: |
python -m build
- name: Check package
run: |
python -m twine check dist/*
- name: List built files
run: |
ls -lh dist/
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-python-${{ matrix.python-version }}
path: dist/*
retention-days: 30
combine-artifacts:
runs-on: ubuntu-latest
needs: build
if: success()
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist-all
- name: Combine distribution files
run: |
mkdir -p dist
find dist-all -name "*.whl" -exec cp {} dist/ \;
find dist-all -name "*.tar.gz" -exec cp {} dist/ \;
echo "Combined distribution files:"
ls -lh dist/
echo ""
echo "Total files:"
ls -1 dist/ | wc -l
- name: Upload combined artifacts
uses: actions/upload-artifact@v4
with:
name: dist-packages
path: dist/*
retention-days: 30
build-and-release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs: combine-artifacts
permissions:
contents: write
steps:
- name: Download combined artifacts
uses: actions/download-artifact@v4
with:
name: dist-packages
path: dist
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: dist/*
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}