Skip to content

Commit

Permalink
chore: fix the release process
Browse files Browse the repository at this point in the history
  • Loading branch information
kalekundert committed Apr 11, 2024
1 parent f730ab4 commit cd91802
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 42 deletions.
50 changes: 10 additions & 40 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,30 @@
name: Release

on:
workflow_dispatch:
inputs:
force-pypi:
description: Force PyPI
type: boolean
required: false
default: false
force-github:
description: Force GitHub
type: boolean
required: false
default: false
on: workflow_dispatch

jobs:
release:
name: Release to PyPI
runs-on: ubuntu-latest
concurrency: release
if: github.repository == 'kalekundert/parametrize_from_file'

environment:
name: release

concurrency: release
permissions:
id-token: write
contents: write

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# Make sure the whole repository history is present, so that
# python-semantic-release can decide if a new release is needed.
fetch-depth: 0

- uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Update version
id: semantic-release
uses: python-semantic-release/python-semantic-release@v8.0.8
- uses: python-semantic-release/python-semantic-release@v9.3.1
id: release
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Build sdist/wheel
run: |
python -m pip install build
python -m build
- name: Upload to PyPI
if: inputs.force-pypi || steps.semantic-release.outputs.released == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
- uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'

- name: Upload to GitHub
if: inputs.force-github || steps.semantic-release.outputs.released == 'true'
uses: python-semantic-release/upload-to-gh-release@main
- uses: python-semantic-release/upload-to-gh-release@main
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
hooks:
- id: ruff
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ doc = [

[tool.ruff]
target-version = "py37"

[tool.ruff.lint]
select = ["F", "E"]
ignore = ["F405", "F403", "E401", "E501", "E721"]

[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401", "E402"]
"docs/**" = ["E701", "E722"]

Expand All @@ -65,5 +67,7 @@ filterwarnings = [
]

[tool.semantic_release]
version_variable = 'parametrize_from_file/__init__.py:__version__'
version_variables = ['parametrize_from_file/__init__.py:__version__']
build_command = 'python -m pip install build && python -m build'
major_on_zero = false

0 comments on commit cd91802

Please sign in to comment.