Skip to content

chore: bump version to 0.0.12 #12

chore: bump version to 0.0.12

chore: bump version to 0.0.12 #12

Workflow file for this run

name: Release
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*' # Matches v1.0.0, v1.0.0-beta, etc.
workflow_dispatch:
inputs:
version_bump:
description: 'Version bump type (or skip to use current version)'
required: true
type: choice
options:
- skip
- patch
- minor
- major
default: 'skip'
prerelease:
description: 'Pre-release'
required: true
type: boolean
default: false
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
issues: read
pull-requests: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for changelog generation
fetch-tags: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Configure Poetry
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
- name: Install dependencies
run: |
poetry install --with dev
- name: Run tests
run: |
poetry run pytest --verbose --cov=prompt_templates --cov-report=term-missing --cov-report=xml
continue-on-error: true
# Only bump version if specifically requested
- name: Bump version if requested
if: github.event_name == 'workflow_dispatch' && inputs.version_bump != 'skip'
run: |
# Bump version
poetry version ${{ inputs.version_bump }}
# Get the new version
NEW_VERSION=$(poetry version -s)
# Create tag
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add pyproject.toml
git commit -m "chore: bump version to ${NEW_VERSION}"
git tag -a "v${NEW_VERSION}" -m "Release version ${NEW_VERSION}"
# Push changes
git push origin main
git push origin "v${NEW_VERSION}"
# Always get current version for later steps
- name: Get current version
run: |
CURRENT_VERSION=$(poetry version -s)
echo "Current version: ${CURRENT_VERSION}"
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
- name: Build package
run: poetry build
- name: Generate Release Notes
id: changelog
uses: mikepenz/release-changelog-builder-action@v5
with:
#configuration: ".github/changelog-config.json"
mode: "HYBRID"
#ignorePreReleases: false
owner: "MoritzLaurer"
repo: "prompt_templates"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: "v${{ env.CURRENT_VERSION }}" # Use current version
body: ${{steps.changelog.outputs.changelog}}
files: |
dist/*.whl
dist/*.tar.gz
draft: false
prerelease: ${{ github.event_name == 'workflow_dispatch' && inputs.prerelease || contains(github.ref, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to PyPI
run: poetry publish --skip-existing