publishing #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: publishing | |
on: | |
workflow_dispatch: | |
jobs: | |
zenodo: | |
env: | |
ZENODO_ACCESS_TOKEN: ${{ secrets.ZENODO_ACCESS_TOKEN }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get a copy of the repo contents | |
uses: actions/checkout@v4 | |
- name: Create preliminary zip | |
run: | | |
zip -x ".git/*" -r -v zenodraft.zip . | |
- name: Validate CITATION.cff | |
uses: citation-file-format/[email protected] | |
with: | |
args: "--validate" | |
- name: Install dependencies and generate tarball | |
shell: bash | |
run: | | |
npm run all | |
- name: Install zenodraft cli | |
shell: bash | |
run: | | |
npm install zenodraft-*.tgz -g | |
zenodraft --version | |
- name: Get prereserved DOI | |
shell: bash | |
run: | | |
VERSION=$(zenodraft deposition create version 5046392) | |
echo "VERSION='$VERSION'" | |
echo "VERSION=$VERSION" >> "$GITHUB_ENV" | |
PRERESERVED=$(zenodraft deposition show prereserved $VERSION) | |
echo "PRERESERVED='$PRERESERVED'" | |
echo "PRERESERVED=$PRERESERVED" >> "$GITHUB_ENV" | |
- name: Update CITATION.cff with prereserved DOI | |
shell: bash | |
run: | | |
yq eval '.identifiers[0].value = "'$PRERESERVED'"' --inplace CITATION.cff --output-format yaml | |
git config --global user.name 'jspaaks via CI' | |
git config --global user.email '[email protected]' | |
git add CITATION.cff | |
git commit -m "updated CITATION.cff with DOI" | |
git push | |
- name: Generate .zenodo.citation.json | |
uses: citation-file-format/[email protected] | |
with: | |
args: "--format zenodo --infile CITATION.cff --outfile .zenodo.citation.json" | |
- name: Create a draft snapshot of the repository contents on Zenodo using metadata | |
from repository file .zenodo.json | |
shell: bash | |
run: | | |
set -e | |
cat .zenodo.citation.json .zenodo.extras.json | jq -s add -S --indent 4 > .zenodo.json | |
cat CITATION.cff | |
cat .zenodo.json | |
zip -u -v zenodraft.zip . CITATION.cff | |
zenodraft file add $VERSION zenodraft.zip | |
zenodraft metadata update $VERSION .zenodo.json |