Skip to content

Instantly share code, notes, and snippets.

@gpetrousov
Created April 7, 2025 21:17
Show Gist options
  • Save gpetrousov/87512abe6951dbb6ad7a3bf6a6002f61 to your computer and use it in GitHub Desktop.
Save gpetrousov/87512abe6951dbb6ad7a3bf6a6002f61 to your computer and use it in GitHub Desktop.
Python release
name: Upload Python Package
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
permissions:
contents: read
jobs:
release-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.8"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build release distributions
run: |
python -m pip install build hatchling hatch
make build
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/
pypi-publish:
runs-on: ubuntu-latest
needs:
- release-build
permissions:
id-token: write
environment:
name: pypi
url: https://pypi.org/project/kubejyg/
steps:
- name: Download distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/
- name: Publish release distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
github-release:
name: Create GitHub Release
needs:
- release-build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
gh release create ${{ github.ref_name }} dist/* --title ${{ github.ref_name }} --generate-notes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment