Skip to content

Build and Publish Wheel to GitHub Pages #7

Build and Publish Wheel to GitHub Pages

Build and Publish Wheel to GitHub Pages #7

Workflow file for this run

name: Build and Release Wheel
on:
workflow_dispatch:
inputs:
python_version:
description: 'Python version to use for the build'
required: true
default: '3.10'
tag_name:
description: 'Release tag (e.g., v0.1.0)'
required: true
default: 'v0.1.0'
jobs:
build_and_release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ github.event.inputs.python_version }}
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build wheel
run: python -m build --wheel
- name: Get wheel filename
id: get_filename
run: |
whl_file=$(ls dist/*.whl)
whl_name=$(basename "$whl_file")
echo "whl_file=$whl_file" >> $GITHUB_OUTPUT
echo "whl_name=$whl_name" >> $GITHUB_OUTPUT
- name: Create and push tag
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
git tag ${{ github.event.inputs.tag_name }}
git push origin ${{ github.event.inputs.tag_name }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event.inputs.tag_name }}
name: Release ${{ github.event.inputs.tag_name }}
files: ${{ steps.get_filename.outputs.whl_file }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}