Files
voculinux/.github/workflows/release.yml
T
dff07ac960 Fix: Use latest release tag for install commands (#74)
* fix: Use latest release tag for install commands instead of main branch

The web install commands previously pointed to install.sh from the main branch,
which could be unstable/untested code. Now they dynamically fetch the latest
release tag from GitHub API and use that for the install script URLs.

Changes:
- Add getInstallCommands() function that takes a release tag
- Add latestRelease state that fetches from GitHub releases API
- Update all install commands to use the fetched release tag
- Fallback to 'main' if GitHub API fails

* docs: Update README and docs to use latest release tag

Also update GitHub release workflow to use the release tag dynamically.

Changes:
- README.md: Update install commands to use v0.3.0-alpha tag
- docs/INSTALL.md: Update install command to use v0.3.0-alpha tag
- .github/workflows/release.yml: Use ${{ github.ref_name }} for install URL
- Add note pointing to GitHub Releases for latest version

---------

Co-authored-by: Claude Opus <noreply@anthropic.com>
2026-01-26 00:45:34 -08:00

133 lines
3.6 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
packages: write
id-token: write # Required for PyPI trusted publishing
env:
PYTHON_VERSION: '3.10'
jobs:
build-and-release:
name: Build and Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine wheel setuptools
- name: Extract version from tag
id: get_version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
echo "Building version: $VERSION"
- name: Verify version consistency
run: |
# Get version from version.py file directly (avoid importing full package which needs gi)
PACKAGE_VERSION=$(grep -oP '__version__\s*=\s*"\K[^"]+' src/vocalinux/version.py)
TAG_VERSION=${{ steps.get_version.outputs.VERSION }}
echo "Package version: $PACKAGE_VERSION"
echo "Tag version: $TAG_VERSION"
# Allow alpha/beta suffixes in package version
if [[ ! "$PACKAGE_VERSION" == *"$TAG_VERSION"* ]] && [[ ! "$TAG_VERSION" == *"$PACKAGE_VERSION"* ]]; then
echo "Warning: Version mismatch between tag ($TAG_VERSION) and package ($PACKAGE_VERSION)"
fi
- name: Build package
run: |
python -m build
echo "Built packages:"
ls -la dist/
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.whl
dist/*.tar.gz
generate_release_notes: true
draft: false
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') || contains(github.ref, 'rc') }}
body: |
## Installation
### Quick Install (Recommended)
```bash
curl -fsSL https://raw.githubusercontent.com/jatinkrmalik/vocalinux/${{ github.ref_name }}/install.sh | bash
```
### From Source
```bash
git clone https://github.com/jatinkrmalik/vocalinux.git
cd vocalinux
./install.sh
```
### From PyPI (if available)
```bash
pip install vocalinux
```
---
See [CHANGELOG](https://github.com/jatinkrmalik/vocalinux/releases) for detailed changes.
publish-pypi:
name: Publish to PyPI
needs: build-and-release
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/vocalinux/
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: |
python -m build
echo "Built packages:"
ls -la dist/
- name: Verify package
run: |
twine check dist/*
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
twine upload dist/* --skip-existing