Release (d00eea484e5164cc3488baddc3108c656e60f3e1
)
#29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
run-name: Release (`${{ github.sha }}`) | |
on: | |
workflow_dispatch: | |
env: | |
PYTHON_VERSION: "3.11" | |
jobs: | |
create-tag: | |
name: Create a Git tag | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
outputs: | |
version: ${{ steps.get-version.outputs.version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
- name: Get the version | |
id: get-version | |
run: | | |
echo "version=$(poetry version --short)" >> "$GITHUB_OUTPUT" | |
- name: Create a Git tag | |
run: | | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions" | |
git fetch --tags | |
git tag --annotate "v${{ steps.get-version.outputs.version }}" --message="v${{ steps.get-version.outputs.version }}" | |
git push origin "v${{ steps.get-version.outputs.version }}" | |
publish-to-pypi: | |
name: Publish to PyPI | |
runs-on: ubuntu-latest | |
needs: create-tag | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
- name: Publish to PyPI | |
run: | | |
git fetch --tags | |
git checkout v${{ needs.create-tag.outputs.version }} | |
poetry publish --build | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} | |
create-release: | |
name: Create a GitHub release | |
runs-on: ubuntu-latest | |
needs: create-tag | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install poetry | |
- name: Create a GitHub release | |
env: | |
GH_TOKEN: ${{ github.token }} | |
run: | | |
gh release create v${{ needs.create-tag.outputs.version }} --verify-tag --generate-notes --title "v${{ needs.create-tag.outputs.version }}" --repo ${{ github.repository }} --target ${{ github.sha }} |