Skip to content

Commit 9235bac

Browse files
authored
Publish Zenodo releases via API (#625)
1 parent 70ddd53 commit 9235bac

5 files changed

Lines changed: 388 additions & 54 deletions

File tree

.github/workflows/publish-pypi.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,3 +129,35 @@ jobs:
129129
uses: softprops/action-gh-release@v2
130130
with:
131131
generate_release_notes: true
132+
133+
publish-zenodo:
134+
name: Publish Zenodo release
135+
needs: publish-github-release
136+
runs-on: ubuntu-latest
137+
if: github.event_name == 'push'
138+
permissions:
139+
contents: read
140+
env:
141+
ZENODO_ACCESS_TOKEN: ${{ secrets.ZENODO_ACCESS_TOKEN }}
142+
steps:
143+
- uses: actions/checkout@v6
144+
145+
- uses: actions/setup-python@v6
146+
with:
147+
python-version: "3.12"
148+
149+
- name: Install release tooling
150+
run: |
151+
python -m pip install --upgrade pip PyYAML
152+
shell: bash
153+
154+
- name: Download artifacts
155+
uses: actions/download-artifact@v8
156+
with:
157+
name: dist-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }}
158+
path: dist
159+
160+
- name: Publish to Zenodo
161+
run: |
162+
python tools/release/publish_zenodo.py --dist-dir dist
163+
shell: bash

.zenodo.json

Lines changed: 0 additions & 39 deletions
This file was deleted.

docs/contributing.rst

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,12 @@ be carried out as follows:
256256
#. Create a new branch ``release-vX.Y.Z`` with the version for the release.
257257

258258
#. Make sure to update ``CHANGELOG.rst`` and that all new changes are reflected
259-
in the documentation. Before tagging, also sync ``CITATION.cff`` and
260-
``.zenodo.json`` to the release version and date:
259+
in the documentation. Before tagging, sync ``CITATION.cff`` to the release
260+
version and date:
261261

262262
.. code-block:: bash
263263
264-
git add CHANGELOG.rst CITATION.cff .zenodo.json
264+
git add CHANGELOG.rst CITATION.cff
265265
git commit -m 'Prepare release metadata'
266266
267267
#. Open a new pull request for this branch targeting ``main``.
@@ -284,11 +284,16 @@ be carried out as follows:
284284
git push origin main --tags
285285
286286
Pushing a ``vX.Y.Z`` tag triggers the release workflow, which publishes the
287-
package and creates the corresponding GitHub release. Zenodo archives GitHub
288-
releases, not bare git tags.
287+
package, creates the corresponding GitHub release, and uploads the same
288+
``dist/`` artifacts to Zenodo through the Zenodo deposit API.
289289

290290
#. After the workflow completes, confirm that the repository "Cite this
291291
repository" panel reflects ``CITATION.cff``, that the release is available
292-
on TestPyPI and PyPI, and that Zenodo created a new release record. If
293-
Zenodo does not create a new version, reconnect the repository in Zenodo
294-
and re-run the GitHub release workflow.
292+
on TestPyPI and PyPI, and that Zenodo created a new release record.
293+
294+
The Zenodo release job uses ``CITATION.cff`` as the maintained metadata
295+
source and requires a GitHub Actions secret named
296+
``ZENODO_ACCESS_TOKEN`` with the Zenodo scopes ``deposit:write`` and
297+
``deposit:actions``. To avoid duplicate Zenodo records, disable the
298+
repository's Zenodo GitHub auto-archiving integration once the API-based
299+
workflow is enabled.

0 commit comments

Comments
 (0)