name: Release on: push: tags: - 'v*' - 'V*' permissions: contents: write packages: write jobs: release: name: Create Release runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.10" - name: Install build tools run: | python -m pip install --upgrade pip pip install build twine - name: Build package run: python -m build - name: Check package run: twine check dist/* - name: Verify no closed-source assets run: | echo "=== Verifying Release Package ===" # Extract and check contents python -c " import tarfile import sys with tarfile.open('dist/' + [f for f in __import__('os').listdir('dist') if f.endswith('.tar.gz')][0], 'r:gz') as tar: names = tar.getnames() closed_patterns = ['git_ignore_folder', 'results/', '.env', 'models/local', 'prompts/local'] found = False for name in names: for pattern in closed_patterns: if pattern in name: print(f'ERROR: Found closed-source asset: {name}') found = True if found: sys.exit(1) print('✓ No closed-source assets in package') " - name: Generate release notes id: release_notes run: | # Try to find changelog for this version VERSION=${GITHUB_REF#refs/tags/} CHANGELOG_FILE="changelog/${VERSION}.md" if [ -f "$CHANGELOG_FILE" ]; then echo "body_path=$CHANGELOG_FILE" >> $GITHUB_OUTPUT elif [ -f "CHANGELOG.md" ]; then # Extract section for this version from main changelog echo "body_path=CHANGELOG.md" >> $GITHUB_OUTPUT else echo "body_path=" >> $GITHUB_OUTPUT fi - name: Create GitHub Release uses: softprops/action-gh-release@v2 with: body_path: ${{ steps.release_notes.outputs.body_path || '' }} files: dist/* draft: false prerelease: false generate_release_notes: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Publish to PyPI if: startsWith(github.ref, 'refs/tags/v') env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} run: twine upload dist/*