Skip to content

Python package release #8

Python package release

Python package release #8

Workflow file for this run

name: Python package release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release'
required: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: "pip"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Update __version__ in __init__.py
run: python .github/workflows/set_version.py ${{ github.event.inputs.version }}
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
- name: Commit and push if changed
run: |
git diff
git diff --quiet || (git add . && git commit -m 'update __version__')
git push https://${{secrets.GITHUB_TOKEN}}@github.com/tatsu-lab/alpaca_farm.git HEAD:main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push Tag
run: |
git pull --tags
git tag v${{ github.event.inputs.version }}
git push origin v${{ github.event.inputs.version }}
- name: Create Release
uses: softprops/action-gh-release@v1
with:
name: Release v${{ github.event.inputs.version }}
tag_name: v${{ github.event.inputs.version }}
draft: false
prerelease: false
repository: tatsu-lab/alpaca_farm
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
run: |
python3 -m pip install --upgrade build
python3 -m build
python3 -m pip install --upgrade twine
python3 -m twine upload dist/*