Skip to content

Commit 9a09ced

Browse files
author
Thomas Hanke
committed
Merge branch 'main' of github.com:Mat-O-Lab/ckanext-matolabtheme
2 parents 9fce280 + 96951cf commit 9a09ced

File tree

4 files changed

+166
-79
lines changed

4 files changed

+166
-79
lines changed

.github/workflows/pypi.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: upload-pypi
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: write
9+
id-token: write
10+
11+
12+
jobs:
13+
release-build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Set version from release tag
18+
run: echo "VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
19+
- uses: actions/checkout@v4
20+
21+
- uses: actions/setup-python@v5
22+
with:
23+
python-version: "3.x"
24+
25+
- name: Build release distributions
26+
run: |
27+
# NOTE: put your own distribution build steps here.
28+
python -m pip install build
29+
python -m build
30+
31+
- name: Upload distributions
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: release-dists
35+
path: dist/
36+
37+
pypi-publish:
38+
runs-on: ubuntu-latest
39+
needs:
40+
- release-build
41+
permissions:
42+
# IMPORTANT: this permission is mandatory for trusted publishing
43+
id-token: write
44+
45+
# Dedicated environments with protections for publishing are strongly recommended.
46+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
47+
environment:
48+
name: pypi
49+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
50+
#url: https://pypi.org/p/${GITHUB_REPOSITORY#*/}
51+
#
52+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
53+
# ALTERNATIVE: exactly, uncomment the following line instead:
54+
url: https://pypi.org/project/${GITHUB_REPOSITORY#*/}/${{ github.event.release.name }}
55+
56+
steps:
57+
- name: Retrieve release distributions
58+
uses: actions/download-artifact@v4
59+
with:
60+
name: release-dists
61+
path: dist/
62+
63+
- name: Publish release distributions to PyPI
64+
uses: pypa/gh-action-pypi-publish@release/v1
65+
with:
66+
packages-dir: dist/
67+
sign-package:
68+
runs-on: ubuntu-latest
69+
needs:
70+
- release-build
71+
steps:
72+
- name: Download all the dists
73+
uses: actions/download-artifact@v4
74+
with:
75+
name: release-dists
76+
path: dist/
77+
- name: Sign the dists with Sigstore
78+
uses: sigstore/[email protected]
79+
with:
80+
inputs: >-
81+
./dist/*.tar.gz
82+
./dist/*.whl
83+
publish-to-testpypi:
84+
name: Publish Python 🐍 distribution 📦 to TestPyPI
85+
needs:
86+
- release-build
87+
runs-on: ubuntu-latest
88+
89+
environment:
90+
name: testpypi
91+
url: https://test.pypi.org/p/${GITHUB_REPOSITORY#*/}
92+
93+
permissions:
94+
id-token: write # IMPORTANT: mandatory for trusted publishing
95+
96+
steps:
97+
- name: Download all the dists
98+
uses: actions/download-artifact@v4
99+
with:
100+
name: release-dists
101+
path: dist/
102+
- name: Publish distribution 📦 to TestPyPI
103+
uses: pypa/gh-action-pypi-publish@release/v1
104+
with:
105+
repository-url: https://test.pypi.org/legacy/

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ include LICENSE
33
include requirements.txt
44
recursive-include ckanext/matolabtheme *.html *.json *.js *.less *.css *.mo *.yml
55
recursive-include ckanext/matolabtheme/migration *.ini *.py *.mako
6+
recursive-include ckanext/matolabtheme/public/static *.svg *.png

README.md

Lines changed: 25 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
[![Tests](https://github.com/Mat-O-Lab/ckanext-matolabtheme/actions/workflows/test.yml/badge.svg)](https://github.com/Mat-O-Lab/ckanext-matolabtheme/actions/workflows/test.yml)
22
# ckanext-matolabtheme
33

4-
**TODO:** Put a description of your extension here: What does it do? What features does it have? Consider including some screenshots or embedding a video!
5-
4+
CKAN theme of the Mat-O-Lab Project, changes landing Page and add alternative Data Privacy Act in English and German.
65

76
## Requirements
87

9-
**TODO:** For example, you might want to mention here which versions of CKAN this
10-
extension works with.
11-
12-
If your extension works across different versions you can add the following table:
13-
148
Compatibility with core CKAN versions:
159

1610
| CKAN version | Compatible? |
@@ -29,31 +23,24 @@ Suggested values:
2923

3024
## Installation
3125

32-
**TODO:** Add any additional install steps to the list below.
33-
For example installing any non-Python dependencies or adding any required
34-
config settings.
35-
36-
To install ckanext-matolabtheme:
26+
To install the extension:
3727

3828
1. Activate your CKAN virtual environment, for example:
39-
40-
. /usr/lib/ckan/default/bin/activate
41-
42-
2. Clone the source and install it on the virtualenv
43-
44-
git clone https://github.com/Mat-O-Lab/ckanext-matolabtheme.git
45-
cd ckanext-matolabtheme
46-
pip install -e .
47-
pip install -r requirements.txt
48-
29+
```bash
30+
. /usr/lib/ckan/default/bin/activate
31+
```
32+
2. Use pip to install package
33+
```bash
34+
pip install ckanext-matolabtheme
35+
```
4936
3. Add `matolabtheme` to the `ckan.plugins` setting in your CKAN
50-
config file (by default the config file is located at
51-
`/etc/ckan/default/ckan.ini`).
52-
53-
4. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:
54-
55-
sudo service apache2 reload
37+
   config file (by default the config file is located at
38+
   `/etc/ckan/default/ckan.ini`).
5639

40+
4. Restart CKAN. For example, if you've deployed CKAN with Apache on Ubuntu:
41+
```bash
42+
sudo service apache2 reload
43+
```
5744

5845
## Config settings
5946

@@ -77,62 +64,23 @@ ckan.favicon = /img/favicon.png
7764
If no contact_url is given, it will relate to the about page!
7865

7966

80-
**TODO:** Document any optional config settings here. For example:
81-
82-
# The minimum number of hours to wait before re-checking a resource
83-
# (optional, default: 24).
84-
ckanext.matolabtheme.some_setting = some_default_value
85-
86-
8767
## Developer installation
8868

89-
To install ckanext-matolabtheme for development, activate your CKAN virtualenv and
69+
To install ckanext-csvtocsvw for development, activate your CKAN virtualenv and
9070
do:
91-
92-
git clone https://github.com/Mat-O-Lab/ckanext-matolabtheme.git
93-
cd ckanext-matolabtheme
94-
python setup.py develop
95-
pip install -r dev-requirements.txt
96-
71+
```bash
72+
git clone https://github.com/Mat-O-Lab/ckanext-matolabtheme.git
73+
cd ckanext-matolabtheme
74+
python setup.py develop
75+
pip install -r dev-requirements.txt
76+
```
9777

9878
## Tests
9979

10080
To run the tests, do:
101-
102-
pytest --ckan-ini=test.ini
103-
104-
105-
## Releasing a new version of ckanext-matolabtheme
106-
107-
If ckanext-matolabtheme should be available on PyPI you can follow these steps to publish a new version:
108-
109-
1. Update the version number in the `setup.py` file. See [PEP 440](http://legacy.python.org/dev/peps/pep-0440/#public-version-identifiers) for how to choose version numbers.
110-
111-
2. Make sure you have the latest version of necessary packages:
112-
113-
pip install --upgrade setuptools wheel twine
114-
115-
3. Create a source and binary distributions of the new version:
116-
117-
python setup.py sdist bdist_wheel && twine check dist/*
118-
119-
Fix any errors you get.
120-
121-
4. Upload the source distribution to PyPI:
122-
123-
twine upload dist/*
124-
125-
5. Commit any outstanding changes:
126-
127-
git commit -a
128-
git push
129-
130-
6. Tag the new release of the project on GitHub with the version number from
131-
the `setup.py` file. For example if the version number in `setup.py` is
132-
0.0.1 then do:
133-
134-
git tag 0.0.1
135-
git push --tags
81+
```bash
82+
pytest --ckan-ini=test.ini
83+
```
13684

13785
## License
13886

setup.py

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,49 @@
11
# -*- coding: utf-8 -*-
2-
from setuptools import setup
2+
from codecs import open # To use a consistent encoding
3+
from os import path, environ
4+
5+
from setuptools import find_packages, setup # Always prefer setuptools over distutils
6+
7+
here = path.abspath(path.dirname(__file__))
8+
9+
10+
# Get the long description from the relevant file
11+
with open(path.join(here, "README.md"), encoding="utf-8") as f:
12+
long_description = f.read()
13+
14+
with open(path.join(here,"requirements.txt")) as f:
15+
requirements = f.read().splitlines()
316

417
setup(
18+
name="""ckanext-matolabtheme""",
519
# If you are changing from the default layout of your extension, you may
620
# have to change the message extractors, you can read more about babel
721
# message extraction at
822
# http://babel.pocoo.org/docs/messages/#extraction-method-mapping-and-configuration
23+
version=environ.get('VERSION', '0.0.0'),
24+
description="""CKAN theme of the Mat-O-Lab Project, changes landing Page and add alternative Data Privacy Act in English and German.""",
25+
long_description=long_description,
26+
long_description_content_type="text/markdown",
27+
install_requires=requirements,
28+
# The project's main homepage.
29+
url="https://github.com/Mat-O-Lab/ckanext-matolabtheme",
30+
# Author details
31+
author="""Thomas Hanke""",
32+
author_email="""[email protected]""",
33+
# Choose your license
34+
license="AGPL",
35+
packages=find_packages(),
36+
include_package_data=True,
937
message_extractors={
1038
'ckanext': [
1139
('**.py', 'python', None),
1240
('**.js', 'javascript', None),
1341
('**/templates/**.html', 'ckan', None),
1442
],
15-
}
43+
},
44+
entry_points="""
45+
[ckan.plugins]
46+
matolabtheme=ckanext.matolabtheme.plugin:MatolabthemePlugin
47+
""",
48+
1649
)

0 commit comments

Comments
 (0)