Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f40f195
Updated template for the init command
nheeb Sep 9, 2024
718e412
Update hermes-ci.yml to install from branch
nheeb Oct 17, 2024
506b7f6
New templates with placeholders for init parameters
nheeb Nov 11, 2024
be4311a
Update TEMPLATE_hermes_github_to_zenodo.yml
SKernchen Feb 25, 2025
ef52576
Delete merged branch from commands
SKernchen Feb 26, 2025
80eef4b
New pip install parameter for plugins
nheeb Apr 7, 2025
469286c
Pip install plugins parameter
nheeb Apr 7, 2025
6b79735
Customizable deposit call
nheeb Jun 5, 2025
c1bd7e6
customizable hermes branch
nheeb Jun 10, 2025
760e5d9
Shorten and Update templates for tag deposit
nheeb Nov 28, 2025
5ef56ce
new jinja versions
nheeb Jan 9, 2026
76960da
Merge branch 'feature/jinja' into feature/init-with-dataverse
nheeb Jan 9, 2026
fbc8360
Init-templates clean
nheeb Jan 9, 2026
926bb2d
Merge branch 'main' into feature/jinja
nheeb Jan 9, 2026
87fd790
update artifact expiry in init templates
nheeb Jan 9, 2026
e8e1a1b
Fixed templates for tag pushing
nheeb Jan 23, 2026
4507085
Getting target branch from tag ref
nheeb Feb 2, 2026
2777bfb
default branch priority when getting branch from tag ref
nheeb Feb 2, 2026
a95da7f
Gitlab get branch from tag ref
nheeb Feb 3, 2026
1062f30
Getting better branch from tag ref & new files to start renaming
nheeb Feb 6, 2026
4020490
fixed bash error
nheeb Feb 6, 2026
8d7a7c1
No error on empty postprocess commit
nheeb Feb 6, 2026
fc8eb91
Remove old templates
nheeb Feb 6, 2026
fa51197
Removed deprecated code from the non-init template
nheeb Feb 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions TEMPLATE_hermes_github_to_zenodo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: pip install hermes
- run: pip install git+https://github.com/softwarepub/hermes.git
- run: hermes harvest
- run: hermes process
- run: hermes curate
Expand Down Expand Up @@ -92,12 +92,12 @@ jobs:
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: pip install hermes
- 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 src > showcase.zip
- run: git archive --format zip HEAD src > artifact.zip

# Run the HERMES deposition and postprocessing steps.
# ADAPT
Expand All @@ -106,7 +106,7 @@ jobs:
# 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 showcase.zip --file README.md
- 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
Expand Down
2 changes: 1 addition & 1 deletion gitlab/hermes-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
python -m venv .hermes-env
fi
- . .hermes-env/bin/activate
- pip install hermes
- pip install git+https://github.com/softwarepub/hermes.git
tags:
- docker
artifacts:
Expand Down
198 changes: 198 additions & 0 deletions init-templates/hermes-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
# SPDX-FileCopyrightText: 2023 German Aerospace Center (DLR), Forschungszentrum Jülich, Helmholtz-Zentrum Dresden-Rossendorf
#
# SPDX-License-Identifier: CC0-1.0

# "Call-back" to create archive
.hermes_create_deposition: &hermes_create_deposition
- git fetch origin "$MR_TARGET_BRANCH"
- git archive --format zip "origin/$MR_TARGET_BRANCH" {%deposit_zip_files%} > $HERMES_ARCHIVE

# Basic building blocks of hermes jobs
# - Set up git with a valid author and configure URL to allow pushes.
.hermes_prepare_git: &hermes_prepare_git
- git config user.name "$GITLAB_USER_NAME"
- git config user.email "$GITLAB_USER_EMAIL"
- git remote set-url origin "${CI_SERVER_PROTOCOL}://__token__:${HERMES_PUSH_TOKEN}@${CI_SERVER_HOST}:${CI_SERVER_PORT}/${CI_PROJECT_PATH}.git"

# - Switch to new MR_SOURCE_BRANCH.
.hermes_switch_branch: &hermes_switch_branch
- git branch "$MR_SOURCE_BRANCH" "origin/$MR_TARGET_BRANCH"
- git switch "$MR_SOURCE_BRANCH"

# - Commit changes and create a matching merge request.
.hermes_create_merge_request: &hermes_create_merge_request
- |
if git diff --cached --quiet; then
echo "No staged changes. Skipping MR creation."
else
git commit -m "$MR_COMMIT_MESSAGE"
git push origin "$MR_SOURCE_BRANCH" \
-o merge_request.create \
-o merge_request.target="$MR_TARGET_BRANCH" \
-o merge_request.title="$MR_TITLE" \
-o merge_request.description="$MR_DESCRIPTION" \
-o merge_request.remove_source_branch
fi

# - Delete all branches created by hermes for curation.
.hermes_cleanup_branches: &hermes_cleanup_branches
- |
for BRANCH in $(git ls-remote origin 'refs/heads/hermes/curate-*' | cut -f2 | cut -d'/' -f'3-'); do
git push origin --delete "$BRANCH"
done

# Base job template for hermes
.hermes_job:
stage: deploy
image: python:3.10
cache:
key: hermes
paths:
- .hermes-env
before_script:
- *hermes_prepare_git
- |
if test ! -d .hermes-env
then
python -m venv .hermes-env
fi
- . .hermes-env/bin/activate
- {%pip_install_hermes%}
{%pip_install_plugins_gitlab%}
tags:
- docker
artifacts:
paths: [".hermes/", "hermes.log"]
when: always

# hermes metadata preparation - this job creates a MR that will trigger deposition when merged.
.hermes_curate:
extends:
- .hermes_job
variables:
MR_BASE_REF: "origin/$CI_COMMIT_BRANCH"
MR_SOURCE_BRANCH: hermes/curate-result-$CI_COMMIT_SHORT_SHA
MR_TARGET_BRANCH: hermes/curate-$CI_COMMIT_SHORT_SHA
MR_COMMIT_MESSAGE: "[hermes] Add metadata for curation"
MR_TITLE: Metadata Curation for Commit $CI_COMMIT_SHORT_SHA
MR_DESCRIPTION: >-
Please carefully review the attached metadata.
If you are satisfied with the result, you may merge this MR, which will trigger publication.
(Any temporary branches will be cleaned up.)
rules:
- exists:
- .hermes/curate/target_branch
when: never
- if: $CI_COMMIT_TITLE =~ /^Merge branch 'hermes\/post-[0-9a-f]{8}' into/
when: never
- if: $CI_PIPELINE_SOURCE == "push" && {%gl_push_condition%}
- when: never
script:
# Run hermes pipeline
- hermes harvest
- hermes process
- hermes curate

# Store branch & commit ref for post-processing
- |
if [ -z "$MR_POST_BRANCH" ]
then
if [ ! -z "$CI_COMMIT_BRANCH" ]
then
MR_POST_BRANCH=$CI_COMMIT_BRANCH
else
MR_POST_BRANCH=""
fi
fi
echo $MR_POST_BRANCH > .hermes/curate/target_branch
echo $CI_COMMIT_REF_NAME > .hermes/curate/commit_ref

# Create target branch for curation merge
- {%gl_create_curate_branch|default('git branch "$MR_TARGET_BRANCH" "$MR_BASE_REF"', true)%}
- git push origin "$MR_TARGET_BRANCH"

# Create curation branch and merge request
- *hermes_switch_branch
- git add -f .hermes/curate
- *hermes_create_merge_request

# hermes deposition and post-processing - this job creates a MR to re-integrate the results of post-processing.
.hermes_deposit:
stage: deploy
extends:
- .hermes_job
variables:
HERMES_ARCHIVE: {%deposit_zip_name%}
MR_SOURCE_BRANCH: hermes/post-$CI_COMMIT_SHORT_SHA
MR_COMMIT_MESSAGE: "[hermes] Add post-processing results"
MR_TITLE: Review hermes post-processing results
MR_DESCRIPTION: >-
This is an automated pull request created by HERMES post-processing.
Please carefully review the changes and finally merge them into your
rules:
- if: $CI_PIPELINE_SOURCE != "push" || $CI_COMMIT_BRANCH !~ /^hermes\/curate-[0-9a-f]{8}/
when: never
- exists:
- .hermes/curate/target_branch
script:
# Restore target branch
- MR_TARGET_BRANCH="$(cat .hermes/curate/target_branch)"

# Get target branch from tag ref if empty
- |
# Test if empty and .hermes/curate/commit_ref exists
if [ -z "$MR_TARGET_BRANCH" ] && [ -s .hermes/curate/commit_ref ]; then
# Get default branch
DEFAULT_BRANCH="$CI_DEFAULT_BRANCH"

# Take tag ref from .hermes/curate/commit_ref
REF="$(tr -d '\r\n' < .hermes/curate/commit_ref)"
TAG="${REF#refs/tags/}"

# Get commit
git fetch --force --tags origin '+refs/heads/*:refs/remotes/origin/*' >/dev/null 2>&1 || true
TAG_COMMIT="$(git rev-parse "${TAG}^{commit}" 2>/dev/null)" || exit 0

# Check if the default or another branch contains the tag commit
if git merge-base --is-ancestor "$TAG_COMMIT" "origin/$DEFAULT_BRANCH"; then
MR_TARGET_BRANCH="$DEFAULT_BRANCH"
else
BRANCH_REF="$(
git for-each-ref --contains "$TAG_COMMIT" --format='%(refname:short)' refs/remotes/origin \
| grep -vE '^origin/(hermes/|HEAD$)' \
| head -n1
)"
if [ -n "$BRANCH_REF" ]; then
MR_TARGET_BRANCH="${BRANCH_REF#refs/heads/}"
fi
fi
fi

{%% if deposit_parameter_zip_file %%}
# Invoke callback to create {%deposit_zip_name%} and publish
- *hermes_create_deposition
{%% endif %%}
# Call deposit to publish
- hermes deposit {%deposit_initial%} {%deposit_parameter_token%} "${%deposit_token_name%}" {%deposit_parameter_zip_file%} {%deposit_extra_files%}

# Skip on missing target branch
- |
if [ -z "$MR_TARGET_BRANCH" ]; then
echo "MR_TARGET_BRANCH is empty. Skipping postprocess."
exit 0
fi

# Prepare clean branch for post-processing and run it
- *hermes_switch_branch
- hermes postprocess

# Put all changes into a merge request (all but .hermes-env)
- git add .
- git reset .hermes-env
- *hermes_create_merge_request
after_script:
- *hermes_cleanup_branches

.hermes_cleanup:
script:
- *hermes_cleanup_branches
Loading
Loading