From cd918021b73aa8927bc94119ff5852cfb8de59ef Mon Sep 17 00:00:00 2001 From: Kale Kundert Date: Thu, 11 Apr 2024 11:26:56 -0400 Subject: [PATCH] chore: fix the release process --- .github/workflows/release.yml | 50 +++++++---------------------------- .pre-commit-config.yaml | 5 ++++ pyproject.toml | 8 ++++-- 3 files changed, 21 insertions(+), 42 deletions(-) create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 663a3e4..8b389b9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..1f8870e --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,5 @@ +repos: +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.3.4 + hooks: + - id: ruff diff --git a/pyproject.toml b/pyproject.toml index c980d90..c168a98 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"] @@ -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