7 Commits

Author SHA1 Message Date
dependabot[bot]
3092533ab3 Bump django from 5.1.14 to 5.1.15 in /example
Bumps [django](https://github.com/django/django) from 5.1.14 to 5.1.15.
- [Commits](https://github.com/django/django/compare/5.1.14...5.1.15)

---
updated-dependencies:
- dependency-name: django
  dependency-version: 5.1.15
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-12-03 14:17:38 +00:00
dependabot[bot]
279d398448 Bump django from 5.1.7 to 5.1.14 in /example (#13)
Bumps [django](https://github.com/django/django) from 5.1.7 to 5.1.14.
- [Commits](https://github.com/django/django/compare/5.1.7...5.1.14)

---
updated-dependencies:
- dependency-name: django
  dependency-version: 5.1.14
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-11 10:40:09 +01:00
dependabot[bot]
b58c0acda5 Bump django from 5.1.4 to 5.1.7 in /example (#5)
Bumps [django](https://github.com/django/django) from 5.1.4 to 5.1.7.
- [Commits](https://github.com/django/django/compare/5.1.4...5.1.7)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-11 20:58:52 +01:00
Daniel Bauer
4ab82d452a doc: add DOI 2025-03-11 20:11:50 +01:00
Daniel Bauer
25fd191ca0 Merge branch 'main' of github.com:dnlbauer/django-signposting 2025-03-11 20:04:59 +01:00
Daniel Bauer
96f9b0ee94 feat: add CITATION and hermes workflow 2025-03-11 20:04:52 +01:00
dependabot[bot]
8d7cd2fd32 Bump django from 5.1.3 to 5.1.4 in /example (#4)
Bumps [django](https://github.com/django/django) from 5.1.3 to 5.1.4.
- [Commits](https://github.com/django/django/compare/5.1.3...5.1.4)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-07 00:56:34 +01:00
6 changed files with 203 additions and 1 deletions

157
.github/workflows/hermes_github.yml vendored Normal file
View File

@@ -0,0 +1,157 @@
# SPDX-FileCopyrightText: 2023 German Aerospace Center (DLR), Forschungszentrum Jülich, Helmholtz-Zentrum Dresden-Rossendorf
#
# SPDX-License-Identifier: CC0-1.0
###############################################################################################################
# TEMPLATE! To use this template, do the following:
#
# 1. Copy this file into the .github/workflows/ directory in your repository and remove the 'TEMPLATE_' prefix.
# 2. Go through the file and carefully adapt to your needs, as marked by an '# ADAPT' comment.
###############################################################################################################
name: Software Publication
on:
# ADAPT
# See the events you can react to at https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
push:
branches:
- main
# NOTE: Do not delete the trigger on closed pull requests, the HERMES workflow needs this.
pull_request:
types:
- closed
jobs:
hermes-prepare:
name: Prepare Metadata for Curation
runs-on: ubuntu-latest
# This condition becomes much easier when we only react to push events on the release branch.
# We still need to exclude the merge commit push of the post processing PR
# ADAPT
# Depending on the event you react to in the 'on:' section above, you will need to adapt this
# to react on the specific events.
# NOTE: You will probably still need to keep the exclusion check for commit messages provided by the workflow ('hermes/'/'hermes/post').
if: >
github.event_name == 'push' && ! (
startsWith(github.ref_name, 'hermes/') ||
contains(github.event.head_commit.message, 'hermes/post')
)
permissions:
contents: write # Allow creation of new branches
pull-requests: write # Postprocessing should be able to create a pull request with changes
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: pip install git+https://github.com/softwarepub/hermes.git
- run: hermes harvest
- run: hermes process
- run: hermes curate
- run: |
# Cache current branch for PR close job
git branch --show-current > .hermes/curate/target_branch
# Shorten the SHA for the PR title
SHORT_SHA=$(echo "$GITHUB_SHA" | cut -c -8)
echo "SHORT_SHA=$SHORT_SHA" >> "$GITHUB_ENV"
# Create a curation branch
git branch -c "hermes/curate-$SHORT_SHA"
git push origin "hermes/curate-$SHORT_SHA"
# Explicitly add to-be-curated metadata (which is ignored via .gitignore!)
git add -f .hermes/curate
- uses: peter-evans/create-pull-request@v5
with:
base: hermes/curate-${{ env.SHORT_SHA }}
branch: hermes/curate-result-${{ env.SHORT_SHA }}
title: Metadata Curation for Commit ${{ env.SHORT_SHA }}
body: |
Please carefully review the attached metadata.
If you are satisfied with the result, you may merge this PR, which will trigger publication.
(Any temporary branches will be cleaned up.)
delete-branch: true
hermes-curate:
name: Publish Software with Curated Metadata
if: github.event.pull_request.merged == true && startsWith( github.base_ref , 'hermes/curate-')
runs-on: ubuntu-latest
permissions:
contents: write # Allow creation of new branches
pull-requests: write # Postprocessing should be able to create a pull request with changes
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: pip install git+https://github.com/softwarepub/hermes.git
# ADAPT
# If you want to publish artifacts (e.g., a zipped snapshot of your repository),
# you can prepare this here.
- run: git archive --format zip HEAD example tests django_signposting > artifact.zip
# Run the HERMES deposition and postprocessing steps.
# ADAPT
# 1. You need to have an authentication token for your target publication platform
# as a GitHub secret in your repository (in this example, this is called ZENODO_SANDBOX).
# 2. Adapt the files you want to deposit. In the example, showcase.zip and README.md are deposited alongside the metadata.
# 3. Check if you want to run with '--initial', as this may potentially create a completely new record (collection),
# rather than a new version of the same collection!
- run: hermes deposit --initial -O invenio_rdm.auth_token ${{ secrets.ZENODO_SANDBOX }} --file artifact.zip --file README.md
# ADAPT
# Remove this command if you don't want to do any postprocessing
- run: hermes postprocess
# ADAPT
# If you don't want to run postprocessing, remove this complete section (next '-run' and 'uses: peter-evans/...' bullets).
#
# Note 1: We change the base branch here for the PR. This flow runs so far within the "curated-metadata-*" branch,
# but now we want to add the changes done by deposit and post processing to the branch that was initially
# meant to be published using HERMES.
# Note 2: The create-pull-request action will NOT inherit the commits we did in the previous job. It will only look at the
# changes within this local workspace we did *now*.
- run: echo "TARGET_BRANCH=$(cat .hermes/curate/target_branch)" >> "$GITHUB_ENV"
- uses: peter-evans/create-pull-request@v5
with:
branch: hermes/post-${{ github.run_id }}
base: ${{ env.TARGET_BRANCH }}
title: Review hermes post-processing results
body: |
This is an automated pull request created by HERMES post-processing.
Please carefully review the changes and finally merge them into your
# Delete all the curation branches
- run: |
for BRANCH in $(git ls-remote origin 'refs/heads/hermes/curate-*' | cut -f2 | cut -d'/' -f'3-'); do
git push origin --delete "$BRANCH"
done
# TODO: if: failure() --- delete the curation branches when the deposition failed
hermes-cleanup:
name: Cleanup aborted curation branches
if: github.event.pull_request.merged == false && startsWith( github.base_ref , 'hermes/curate-')
runs-on: ubuntu-latest
permissions:
contents: write # Allow creation of new branches
pull-requests: write # Postprocessing should be able to create a pull request with changes
steps:
- uses: actions/checkout@v3
# Delete all the curation branches
- run: |
for BRANCH in $(git ls-remote origin 'refs/heads/hermes/curate-*' | cut -f2 | cut -d'/' -f'3-'); do
git push origin --delete "$BRANCH"
done

3
.gitignore vendored
View File

@@ -5,3 +5,6 @@ dist
build
__pycache__
*.sqlite3
# Ignoring all HERMES cache files
.hermes/
hermes.log

29
CITATION.cff Normal file
View File

@@ -0,0 +1,29 @@
# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!
cff-version: 1.2.0
title: FAIR signposting middleware for Django
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Daniel
family-names: Bauer
email: daniel.bauer@senckenberg.de
affiliation: Senckenberg Society for Nature Research
orcid: 'https://orcid.org/0000-0001-9447-460X'
abstract: >-
django_signposting is a Django middleware library that
facilitates the addition of FAIR signposting headers to
HTTP responses. This middleware helps in making your data
more FAIR (Findable, accessible, interoperable, reuseable)
by embedding signposting headers in responses, guiding
clients to relevant resources linked to the response
content.
keywords:
- django
- FAIR
- signposting
- links
license: MIT

View File

@@ -164,3 +164,7 @@ on the detected signposting metadata and produces output similar to the one show
## License
Licensed under the MIT License.
## References
You can cite this library using this DOI: [10.5281/zenodo.15008517](https://doi.org/10.5281/zenodo.15008517).

View File

@@ -2,7 +2,7 @@ asgiref==3.8.1
beautifulsoup4==4.12.3
certifi==2024.8.30
charset-normalizer==3.4.0
django==5.1.3
django==5.1.15
django-json-ld==0.0.5
django-signposting==0.10.0
httplink==0.2.0

9
hermes.toml Normal file
View File

@@ -0,0 +1,9 @@
[harvest]
sources = [ "cff",]
[deposit]
target = "invenio_rdm"
[deposit.invenio_rdm]
site_url = "https://zenodo.org/"
access_right = "open"