Skip to content

Commit

Permalink
Merge pull request #983 from PMEAL/maint/simplify-release-workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
ma-sadeghi authored Aug 9, 2024
2 parents 4f6991d + 1daa167 commit 21558ec
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 54 deletions.
54 changes: 0 additions & 54 deletions .github/workflows/publish-to-pypi.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy to PyPI

on:
workflow_dispatch:
inputs:
version:
description: 'Version (major/minor/patch/alpha/beta/release)'
required: true
default: 'patch'

jobs:
deploy:
name: Publish 🐍 📦 to PyPI
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: dev
fetch-depth: 0
fetch-tags: true
token: ${{ secrets.PAT }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[build]
- name: Bump up version and create tag
run: |
hatch version ${{ github.event.inputs.version }}
echo "VERSION=v$(hatch version)" >> $GITHUB_ENV
- name: Commit version bump + push tag
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Bump version to ${{ env.VERSION }}
commit_author: GitHub Actions <actions@github.com>
tagging_message: ${{ env.VERSION }}

- name: Build and publish to PyPI 📦
run: |
export HATCH_INDEX_USER="__token__"
export HATCH_INDEX_AUTH="${{ secrets.HATCH_INDEX_AUTH }}"
hatch build
hatch publish
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ dev-dependencies = [
"sphinx",
"sphinx-copybutton",
"sphinx-design",
"nanomesh",
"scikit-fmm",
]

[tool.hatch.metadata]
Expand Down
77 changes: 77 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]

# Same as Black.
line-length = 95
indent-width = 4

# Assume Python 3.10
target-version = "py310"

[lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E4", "E7", "E9", "F", "W"]
ignore = ["E731"]

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[format]
# Like Black, use double quotes for strings.
quote-style = "double"

# Like Black, indent with spaces, rather than tabs.
indent-style = "space"

# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false

# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"

# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = true

# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"

0 comments on commit 21558ec

Please sign in to comment.