Skip to content
Merged
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
b478a4b
docs: initial draft of first user tutorial
poikilotherm Jan 12, 2023
9ffc0f3
Merge branch 'develop' into feature/35-first-user-tutorial
poikilotherm Feb 20, 2023
c41e64f
doc(tut): adapt first tutorial to latest developments
poikilotherm Feb 20, 2023
a52a809
fix,docs(tut): change to correct pygement lexer
poikilotherm Feb 20, 2023
bb45372
Merge branch 'develop' into feature/35-first-user-tutorial
poikilotherm May 17, 2023
6d32975
docs: add Sphinx Click extension
poikilotherm May 17, 2023
1dcd652
docs: add initial CLI usage help page
poikilotherm May 17, 2023
8e6cbb4
docs: correction of repository button URL
poikilotherm May 17, 2023
15e9dd8
chore: update poetry.lock after adding sphinx-click
poikilotherm May 17, 2023
1c6a942
docs: remove the CLI page from the toctree for now until this is more…
poikilotherm May 17, 2023
af1c92b
Remove CLI Usage section
sdruskat May 17, 2023
8e9abe8
Update tutorial to use CI template
sdruskat May 17, 2023
240c068
Update callout role
sdruskat May 17, 2023
a5c2b08
Add link to Zenodo versioning docs
sdruskat May 17, 2023
4dbabe3
Update docs/source/tutorials/automated-publication-with-ci.md
sdruskat May 22, 2023
bfab229
docs: add Mermaid support for nice diagrams from within Sphinx
poikilotherm May 22, 2023
3160783
docs: some tweaks to the code blocks and admonitions
poikilotherm May 22, 2023
083e0d1
docs: add diagram of Github deposition workflow in a margin
poikilotherm May 22, 2023
c710402
Refine and embed mermaid graph
sdruskat May 23, 2023
0b056d4
Add postprocessing config
sdruskat May 23, 2023
d86f109
Put graph back in margin
sdruskat May 23, 2023
e18fadc
Switch order of harvesters in example config
sdruskat May 23, 2023
e5bd179
docs: Move diagram up in margin
sdruskat May 23, 2023
b0278f3
Merge pull request #180 from hermes-hmc/pr-update/most-basic-ci-tutorial
sdruskat May 23, 2023
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
4 changes: 3 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
"sphinxext.opengraph",
'myst_parser',
'autoapi.extension',
'sphinx_click',
'sphinxcontrib.mermaid',
]

language = 'en'
Expand Down Expand Up @@ -115,7 +117,7 @@
target='_blank'>Helmholtz Association</a> in the framework of the \
<a href='https://helmholtz-metadaten.de' targe='_blank'>Helmholtz Metadata \
Collaboration</a></div>",
"repository_url": "https://github.com/hermes-hmc/project",
"repository_url": "https://github.com/hermes-hmc/workflow",
"use_repository_button": True,
}

Expand Down
13 changes: 13 additions & 0 deletions docs/source/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ automatic submission to publication repositories.
![](_static/img/workflow-overview.svg)

## Documentation

<!--
```{toctree}
cli
```
-->

```{toctree}
:glob:
:maxdepth: 1
:caption: Tutorials
tutorials/*
```

```{toctree}
:maxdepth: 1
Expand Down
168 changes: 168 additions & 0 deletions docs/source/tutorials/automated-publication-with-ci.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
<!--
SPDX-FileCopyrightText: 2023 German Aerospace Center (DLR), Forschungszentrum Jülich GmbH

SPDX-License-Identifier: CC-BY-SA-4.0
-->

<!--
SPDX-FileContributor: Oliver Bertuch
SPDX-FileContributor: Michael Meinel
SPDX-FileContributor: Stephan Druskat
-->

# Set up automatic software publishing

```{note}
This tutorial works for repositories hosted on GitHub, and shows how to automatically publish to Zenodo Sandbox.
Zenodo Sandbox is a "toy" repository that can be used to try things out.

This tutorial should also work with the "real" Zenodo.
```

## Configure your .gitignore

The HERMES workflow (`hermes`) uses temporary caches in `.hermes/`.
Ignore this directory in your git repository.

Add `.hermes/` to your `.gitignore` file:

```{code-block} bash
:caption: .gitignore

.hermes/
```

## Provide additional metadata using CITATION.cff

To provide high-quality citation metadata for your project and your publication,
provide a `CITATION.cff` file in the [Citation File Format](https://citation-file-format.github.io/).

If you don't have one yet,
use the [cffinit](https://citation-file-format.github.io/cff-initializer-javascript/) website
to create a `CITATION.cff` file.
Save it to the root directory of your repository, and add it to version control.

```bash
git add CITATION.cff
git commit -m "Add citation file"
git push
```

## HERMES configuration

The HERMES workflow is configured in a [TOML](https://toml.io) file: `hermes.toml`.
Each step in the publication workflow has its own section.

Configure HERMES to:

- harvest metadata from Git and `CITATION.cff`
- skip validation of `CITATION.cff`
- deposit on Zenodo Sandbox (which is built on the InvenioRDM)
- use Zenodo Sandbox as the target publication repository

```{code-block} toml
:caption: hermes.toml
:name: hermes.toml

[harvest]
from = [ "git", "cff" ]

[harvest.cff]
validate = false

[deposit]
mapping = "invenio"
target = "invenio"

[deposit.invenio]
base_url = "https://sandbox.zenodo.org"

[postprocess]
execute = [ "config_record_id" ]
```

Copy this file to your repository and add it to version control:

```bash
git add hermes.toml
git commit -m "Configure HERMES to harvest git and CFF, and deposit on Zenodo Sandbox"
git push
```

## Get a personal access token for Zenodo Sandbox

To allow GitHub Actions to publish our repository to Zenodo Sandbox for us,
we need a personal access token from Zenodo Sandbox.

Log in at https://sandbox.zenodo.org (you may have to register first),
then [create a personal access token in your user profile](https://sandbox.zenodo.org/account/settings/applications/tokens/new/)
with the scopes `deposit:actions` and `deposit:write`.

Copy the newly created token into a new [GitHub Secret](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) called `ZENODO_SANDBOX` in your repository.

## Configure a GitHub Action to automate publication

The HERMES project provides templates for continous integration systems in a dedicated repository:
https://github.com/hermes-hmc/ci-templates.

Copy the [template for GitHub to Zenodo Sandbox publication](https://github.com/hermes-hmc/ci-templates/blob/main/TEMPLATE_hermes_github_to_zenodo.yml)
into the `.github/workflows/` directory in your repository, and rename it as you like (e.g. `hermes_github_to_zenodo.yml`).

Go through the file, and look for comments marked with `# ADAPT`.
Adapt the file to your needs.
If you need help with how GitHub Action workflows work in general,
have a look at the [documentation on GitHub](https://docs.github.com/actions).

Add the workflow file to version control and push it.

```{warning}
If you haven't adapted the workflow file, and push it to the branch `main`, you will create an automatic publication at this point.
```

```bash
git add .github/workflows/hermes_github_to_zenodo.yml
git commit -m "Configure automatic publication with HERMES"
git push
```

## Automatic publication workflow

````{margin}
```{mermaid}
flowchart TD
t(("Trigger\nGitHub Action\n(e.g. push)"))
rh("Run hermes")
subgraph "hermes (harvest, process, curate)"
ci1("Harvest & process metadata")
pr1("Create curation pull request")
end
d{"Merge?"}
subgraph "hermes (deposit, postprocess)"
ci2("Publish software")
pp("Postprocessing")
pr2("Create pull request\nfrom postprocessing")
ci3("Cleanup")
end
e((("End")))
t --> rh --> ci1 --> pr1 --> d -->|Merge| ci2 --> pp --> pr2 --> e
d -->|Close| ci3 --> e
```
````

```{admonition} Congratulations!
You can now automatically publish your repository to Zenodo Sandbox!
```

Now, whenever the GitHub Actions workflow is triggered, it will publish a new version of your repository to Zenodo Sandbox.
If you haven't adapted the workflow file, this will happen whenever you push to your `main` branch.

The diagram to the right shows the different steps that will happen each time.

When the workflow runs, it harvests and processes the metadata from Git and your `CITATION.cff` file,
and creates a new pull request in your repository.
You then have the chance to curate the metadata, i.e., make sure that it looks the way you want.
If you merge the pull request, the actual publication is created,
and a new pull request is opened to update the HERMES configuration file
in your repository
with the ID of the publication.
This is needed so that future published versions are collected under the same [*concept DOI*](https://help.zenodo.org/#versioning).
Loading