Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/publish_npm_pkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish npm Package to npm

on:
release:
types: [created]
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
working-directory: ./ufazien-cli-js
run: npm ci

- name: Build package
working-directory: ./ufazien-cli-js
run: npm run build

- name: Publish to npm
working-directory: ./ufazien-cli-js
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access public
40 changes: 40 additions & 0 deletions .github/workflows/publish_python_pkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish Python Package to PyPI

on:
release:
types: [created]
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
working-directory: ./ufazien-cli-py
run: |
python -m build

- name: Publish to PyPI
working-directory: ./ufazien-cli-py
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python -m twine upload dist/*
82 changes: 82 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Release

on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.1.0)'
required: true
type: string

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get version from tag or input
id: get_version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
echo "tag=v${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
elif [[ "${{ github.ref }}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi

- name: Get package versions
id: get_package_versions
run: |
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == refs/tags/* ]]; then
# Extract versions from package files
PYTHON_VERSION=$(grep -E '^version\s*=' ufazien-cli-py/pyproject.toml | sed -E 's/.*version\s*=\s*"([^"]+)".*/\1/' | sed -E 's/.*version\s*=\s*([0-9.]+).*/\1/')
NPM_VERSION=$(grep -E '"version"' ufazien-cli-js/package.json | head -1 | sed -E 's/.*"version"\s*:\s*"([^"]+)".*/\1/')
echo "python_version=$PYTHON_VERSION" >> $GITHUB_OUTPUT
echo "npm_version=$NPM_VERSION" >> $GITHUB_OUTPUT
else
echo "python_version=${{ steps.get_version.outputs.version }}" >> $GITHUB_OUTPUT
echo "npm_version=${{ steps.get_version.outputs.version }}" >> $GITHUB_OUTPUT
fi

- name: Create Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.get_version.outputs.tag }}
name: Release ${{ steps.get_version.outputs.tag }}
body: |
## Changes in ${{ steps.get_version.outputs.tag }}

### Python Package
- Version: ${{ steps.get_package_versions.outputs.python_version }}
- Install: `pip install ufazien-cli==${{ steps.get_package_versions.outputs.python_version }}`

### npm Package
- Version: ${{ steps.get_package_versions.outputs.npm_version }}
- Install: `npm install -g ufazien-cli@${{ steps.get_package_versions.outputs.npm_version }}`

## Installation

**Python:**
```bash
pip install ufazien-cli
```

**Node.js:**
```bash
npm install -g ufazien-cli
```
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47 changes: 47 additions & 0 deletions .github/workflows/test_npm_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Test npm Package

on:
pull_request:
branches: [main]
paths:
- 'ufazien-cli-js/**'
- '.github/workflows/test_npm_package.yml'

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
node-version: ['18', '20', '22']

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
working-directory: ./ufazien-cli-js
run: npm ci

- name: Build package
working-directory: ./ufazien-cli-js
run: npm run build

- name: Type check
working-directory: ./ufazien-cli-js
run: npx tsc --noEmit

- name: Test package installation
working-directory: ./ufazien-cli-js
run: |
npm pack
npm install -g ufazien-cli-*.tgz

- name: Verify CLI command
run: |
ufazienjs --help
62 changes: 62 additions & 0 deletions .github/workflows/test_python_pkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Test Python Package

on:
pull_request:
branches: [main]
paths:
- 'ufazien-cli-py/**'
- '.github/workflows/test_python_pkg.yml'

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
working-directory: ./ufazien-cli-py
run: |
python -m pip install --upgrade pip
pip install -e .

- name: Install test dependencies
working-directory: ./ufazien-cli-py
run: |
pip install pytest pytest-cov black ruff mypy

- name: Check code formatting with Black
working-directory: ./ufazien-cli-py
run: |
black --check src/

- name: Lint with Ruff
working-directory: ./ufazien-cli-py
run: |
ruff check src/

- name: Type check with mypy
working-directory: ./ufazien-cli-py
run: |
mypy src/ || true

- name: Test package installation
working-directory: ./ufazien-cli-py
run: |
python -m pip install build
python -m build
pip install dist/*.whl

- name: Verify CLI command
run: |
ufazien --help
1 change: 1 addition & 0 deletions ufazien-cli-js/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pnpm-lock.yaml

# Build output
dist/
test/
*.tsbuildinfo

# Environment
Expand Down
2 changes: 1 addition & 1 deletion ufazien-cli-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ufazien-cli",
"version": "0.1.4",
"version": "0.2.0",
"type": "module",
"main": "dist/cli.js",
"bin": {
Expand Down
Loading
Loading