Skip to content

Commit 54ced15

Browse files
authored
Merge pull request #14 from LibraryOfCongress/use-github-actions-to-publish-packages
New GitHub Actions: pre-commit, publish releases
2 parents 7c957ad + 4101848 commit 54ced15

File tree

15 files changed

+554
-310
lines changed

15 files changed

+554
-310
lines changed

.github/workflows/pre-commit.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: unit tests
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
push: # run on every push or PR to any branch
8+
pull_request:
9+
10+
jobs:
11+
pre-commit:
12+
name: pre-commit
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout repository
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: "3.13"
22+
23+
- run: pip install pre-commit
24+
25+
- uses: actions/cache@v4
26+
with:
27+
path: ~/.cache/pre-commit
28+
key: pre-commit|${{ hashFiles('.pre-commit-config.yaml') }}
29+
30+
- run: pre-commit run --show-diff-on-failure --color=always

.github/workflows/pypi-release.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "PyPI releases"
2+
3+
on: release
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
build_sdist:
10+
name: Build Python source distribution
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Build sdist
16+
run: pipx run build --sdist
17+
18+
- uses: actions/upload-artifact@v4
19+
with:
20+
path: dist/*.tar.gz
21+
22+
pypi-publish:
23+
name: Upload release to PyPI
24+
if: github.event_name == 'release' && github.event.action == 'published'
25+
needs:
26+
- build_sdist
27+
runs-on: ubuntu-latest
28+
environment:
29+
name: release
30+
url: https://pypi.org/p/django-tabular-export
31+
permissions:
32+
id-token: write
33+
steps:
34+
- uses: actions/download-artifact@v4
35+
with:
36+
name: artifact
37+
path: dist
38+
- name: Publish package distributions to PyPI
39+
uses: pypa/gh-action-pypi-publish@release/v1

.pre-commit-config.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
exclude: ".*/vendor/.*"
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v5.0.0
5+
hooks:
6+
- id: check-added-large-files
7+
args: ["--maxkb=128"]
8+
- id: check-ast
9+
- id: check-byte-order-marker
10+
- id: check-case-conflict
11+
- id: check-docstring-first
12+
- id: check-executables-have-shebangs
13+
- id: check-json
14+
- id: check-merge-conflict
15+
- id: check-symlinks
16+
- id: check-toml
17+
- id: check-xml
18+
- id: check-yaml
19+
- id: debug-statements
20+
- id: detect-private-key
21+
- id: end-of-file-fixer
22+
- id: mixed-line-ending
23+
args: ["--fix=lf"]
24+
- id: pretty-format-json
25+
args: ["--autofix", "--no-sort-keys", "--indent=4"]
26+
- id: trailing-whitespace
27+
28+
- repo: https://github.com/executablebooks/mdformat
29+
rev: 0.7.22
30+
hooks:
31+
- id: mdformat
32+
additional_dependencies:
33+
- mdformat-gfm
34+
35+
- repo: https://github.com/gruntwork-io/pre-commit
36+
rev: v0.1.29
37+
hooks:
38+
- id: shellcheck
39+
40+
- repo: https://github.com/astral-sh/ruff-pre-commit
41+
rev: v0.11.10
42+
hooks:
43+
- id: ruff-check
44+
args: ["--fix", "--exit-non-zero-on-fix"]
45+
- id: ruff-format

CHANGELOG.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,3 @@ Other
3636
v1.0.0 (2016-03-04)
3737
-------------------
3838
- Initial Release. [Chris Adams]
39-
40-

0 commit comments

Comments
 (0)