From 90662ccafadb473be9e1647d242412fa2eb90d1b Mon Sep 17 00:00:00 2001
From: Damien Delforge <dam.delforge@gmail.com>
Date: Thu, 28 Nov 2024 23:00:50 +0100
Subject: [PATCH] Add workflow to publish releases to Zenodo

This commit introduces a new GitHub Actions workflow that automates the publishing of releases to Zenodo. The workflow is triggered on the creation of a new release that is not marked as a prerelease. Additionally, it renames the existing publish.yml to publish-pypi.yml for clarity.
---
 .../{publish.yml => publish-pypi.yml}         |  0
 .github/workflows/publish-zenodo.yml          | 27 +++++++++++++++++++
 2 files changed, 27 insertions(+)
 rename .github/workflows/{publish.yml => publish-pypi.yml} (100%)
 create mode 100644 .github/workflows/publish-zenodo.yml

diff --git a/.github/workflows/publish.yml b/.github/workflows/publish-pypi.yml
similarity index 100%
rename from .github/workflows/publish.yml
rename to .github/workflows/publish-pypi.yml
diff --git a/.github/workflows/publish-zenodo.yml b/.github/workflows/publish-zenodo.yml
new file mode 100644
index 0000000..c94c49e
--- /dev/null
+++ b/.github/workflows/publish-zenodo.yml
@@ -0,0 +1,27 @@
+name: Publish to Zenodo
+
+on:
+  release:
+    types: [published]
+
+    # Filter out prereleases
+    if: "!github.event.release.prerelease"
+
+jobs:
+  publish:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
+
+      - name: Publish to Zenodo
+        uses: zenodraft/actions@v1
+        env:
+          ZENODO_TOKEN: ${{ secrets.ZENODO_TOKEN }}
+        with:
+          collection: ${{ secrets.ZENODO_COLLECTION_ID }} # Optional
+          draft: false
+          publish: true
+          sandbox: false # Set to true for testing
\ No newline at end of file