Skip to content

Commit

Permalink
Modernize release workflow use most recent tool (#291)
Browse files Browse the repository at this point in the history
* modernize release workflow

* fix file path
  • Loading branch information
Czaki authored Aug 16, 2024
1 parent b50df55 commit f64dc32
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,39 @@
name: Release

on:
release:
types: [published]
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
pull_request:
paths:
- .github/workflows/release.yml

jobs:
release:
# requires that you have put your twine API key in your
# github secrets (see readme for details)
runs-on: ubuntu-latest
if: contains(github.ref, 'tags')
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: hynek/build-and-inspect-python-package@v2
- name: determine tag
run: echo "tag=${GITHUB_REF/refs\/tags\/v/}" >> "$GITHUB_ENV"
- name: Create Release
uses: "softprops/action-gh-release@v2"
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
with:
tag_name: ${{ github.ref }}
name: ${{ env.tag }}
draft: false
prerelease: ${{ contains(env.tag, 'rc') || contains(env.tag, 'a') || contains(env.tag, 'b') }}
target_commitish: ${{ github.sha }}
files: |
dist/*
- name: Publish PyPI Package
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools setuptools_scm wheel twine build
- name: Build and publish
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TWINE_API_KEY }}
run: |
git tag
python -m build .
twine upload dist/*
password: ${{ secrets.TWINE_API_KEY }}

0 comments on commit f64dc32

Please sign in to comment.