Coder Social home page Coder Social logo

upload-to-zenodo's Introduction

Upload a GitHub release to Zenodo

This is a Github action to update your codemeta.json, CITATION.cff and .zenodo.json files with the release information and then upload your release to Zenodo.

This action uses the tag name of the release to update the version field in the metadata files. Be sure to use the correct tag name. Within your tag name a valid semver version should be present.

When update metadata files are added to your repository, the action will automatically send the new metadata files in its release. This will also mean that your Github release will not contain the updated metadata files. To avoid this, you can set the update_metadata_files option to false and add a .zenodo.json file.

Remember to remove the webhook from your repository before using this action. Otherwise, you will have two releases on Zenodo for every release on Github.

Currently the following files and fields will be updated:

* `codemeta.json`:
    * `version`: The release version
    * `identifier`: The release identifier (Zenodo version specific doi)

* `CITATION.cff`:
    * `version`: The release version
    * `identifiers`: The release identifier (Zenodo version specific doi).
    This action currently assumes your old zenodo doi is the first item in the list.

* `.zenodo.json`:
    * `version`: The release version

* `docs.compatibility.json`
    * A new entry will be added in this file. This entry is meant for versioned Docusaurus projects
        * `docsVersion` - The new docs version
        * `appVersion` - The latest app version

Inputs

A list of all inputs to the action is as follows:

github_token - Required - The GitHub token used to authenticate with GitHub. If not present, the action will attempt to read the token from the GITHUB_TOKEN environment variable.

zenodo_token - Required - The Zenodo token used to authenticate with Zenodo.

zenodo_deposition_id - Required - The Zenodo deposition ID to upload the release to.

zenodo_publish - Optional - Whether to publish the release. Defaults to false.

zenodo_sandbox - Optional - Whether to use the Zenodo sandbox. Defaults to false.

committer_name - Optional - The name of the committer.

committer_email - Optional - The email of the committer.

commit_message - Optional - The commit message. Defaults to chore: update ${file_name} for Zenodo release. You can use the ${file_name} variable to refer to the metdata file name in the commit message.

update_metadata_files - Optional - Whether to update the metadata files. Defaults to true. This will also push the changes to GitHub.

codemeta_json - Optional - Whether a codemeta.json file exists in the repository and needs to be updated for the new release. Defaults to false.

citation_cff - Optional - Whether a CITATION.cff file exists in the repository and needs to be updated for the new release. Defaults to false.

zenodo_json - Optional - Whether a .zenodo.json file exists in the repository and needs to be updated for the new release. Defaults to false.

docs_compatibility_json - Optional - Whether a docs.compatibility.json file exists in the repository and needs to be updated for the new release. Defaults to false.

Outputs

doi - The Zenodo DOI of the release.

version - The version of the release.

Example usage

A sample action is shown below.

name: Release on Zenodo

on:
  release:
    types: [published]

jobs:
  upload-to-zenodo:
    runs-on: ubuntu-latest
    name: A job to update metadata and push a release to Zenodo

    steps:
      # This step is not needed at the moment but might decide to add on more steps in the future
      - name: Set up Node.js
        uses: actions/setup-node@v3
        with:
          node-version: 16

      - name: Upload to Zenodo
        id: release
        uses: megasanjay/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          zenodo_token: ${{ secrets.ZENODO_TOKEN }}
          zenodo_deposition_id: SOME_DEPOSITION_ID
          zenodo_publish: true
          zenodo_sandbox: false
          commit_message: 'chore: update ${file_name} for Zenodo release'
          update_metadata_files: true
          codemeta_json: true
          citation_cff: true
          zenodo_json: true

      # Get the doi from the `release` step
      - name: Get the output doi
        run: echo "The released doi was ${{ steps.release.outputs.doi }}"

Build and release instructions

To build and release a new version of the action, run the following commands:

npm install
npm run build

git commit -a -m "chore: release action v1.2.3"
git tag -a -m "Action v1.2.3 release" v1.2.3
git push --follow-tags

upload-to-zenodo's People

Contributors

dependabot[bot] avatar github-actions[bot] avatar lint-action avatar megasanjay avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

upload-to-zenodo's Issues

needs to be generalized so action can run from branches other than `main`

I am testing this action to upload to the Zenodo sandbox in a separate branch (beta_prep), so as not to contaminate the main branch until it's ready to go, and I was puzzled by the failures to find the .zenodo.json file:

https://github.com/alexlancaster/pypop/actions/runs/6269876124/job/17026982885#step:3:18

Then I realized that it's looking for:

https://api.github.com/repos/alexlancaster/pypop/contents/.zenodo.json

which doesn't (yet) exist in the main branch, however if the URL is changed to include the branch beta_prep using ref:

https://api.github.com/repos/alexlancaster/pypop/contents/.zenodo.json?ref=beta_prep

This looks pretty straightforward to solve, but I lack the Javascript skills. Also it makes me think that this also may need adjusting on the commit side as well. It may try and commit to the main branch. Either way the action needs to be updated to take into account. I can try and fork the repo and hack it until it works and submit a PR if that's helpful.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Warning

These dependencies are deprecated:

Datasource Name Replacement PR?
npm rollup-plugin-terser Available

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • fix(deps): update dependency dayjs to v1.11.12
  • fix(deps): update dependency semver to v7.6.3
  • chore(deps): update dependency eslint to v9
  • chore(deps): update dependency prettier to v3
  • chore(deps): update dependency rollup-plugin-esbuild to v6
  • fix(deps): update dependency @actions/github to v6
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

  • chore(deps): update dependency dotenv to v16.4.5
  • chore(deps): update dependency prettier to v2.8.8
  • chore(deps): update dependency rollup-plugin-esbuild to v4.10.3
  • chore(deps): update dependency jest to v29
  • fix(deps): update dependency axios to v1

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/check-misspellings.yml
  • actions/checkout v4
.github/workflows/lint-check.yml
  • actions/checkout v4
  • actions/setup-node v4
  • wearerequired/lint-action v2
.github/workflows/main.yml
  • actions/setup-node v4
  • megasanjay/upload-to-zenodo v2.0.1
.github/workflows/stale.yml
  • actions/stale v9
npm
package.json
  • @actions/core ^1.8.2
  • @actions/github ^5.0.3
  • axios ^0.28.0
  • dayjs ^1.11.5
  • js-yaml ^4.1.0
  • lodash ^4.17.21
  • mime-types ^2.1.35
  • semver ^7.3.7
  • @rollup/plugin-commonjs 22.0.2
  • @rollup/plugin-json 4.1.0
  • @rollup/plugin-node-resolve 13.3.0
  • @vercel/ncc 0.38.1
  • builtin-modules 3.3.0
  • dotenv 16.0.1
  • eslint 8.57.0
  • jest 28.1.3
  • prettier 2.7.1
  • rollup-plugin-esbuild 4.9.3
  • rollup-plugin-terser 7.0.2

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.