Skip to content

Merge pull request #757 from sjsrey/w-to-g-guide #29

Merge pull request #757 from sjsrey/w-to-g-guide

Merge pull request #757 from sjsrey/w-to-g-guide #29

# Release package on GitHub and publish to PyPI
# Important: In order to trigger this workflow for the organization
# repo (organzation-name/repo-name vs. user-name/repo-name), a tagged
# commit must be made to *organzation-name/repo-name*. If the tagged
# commit is made to *user-name/repo-name*, a release will be published
# under the user's name, not the organzation.
#--------------------------------------------------
name: Release & Publish
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
workflow_dispatch:
inputs:
version:
description: Manual Release
default: test
required: false
jobs:
build:
name: Create release & publish to PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all branches and tags.
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install Dependencies
run: |
python -m pip install --upgrade pip build twine
python -m build
twine check --strict dist/*
- name: Create Release Notes
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
await github.request(`POST /repos/${{ github.repository }}/releases`, {
tag_name: "${{ github.ref }}",
generate_release_notes: true
});
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}