Skip to content

Add additional information to project CITATION.cff file #7140

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 21, 2025
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
102 changes: 102 additions & 0 deletions .github/workflows/citation-updater.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Zero-config modular workflow for updating CITATION.cff upon new releases.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

name: CITATION.cff updater
run-name: Update CITATION.cff for new release

on:
release:
types: [published]

# Allow manual invocation.
workflow_dispatch:
inputs:
use_tag:
description: 'Value of tag_name to use:'
type: string
required: true
use_date:
description: 'Value of published_date to use:'
type: string
required: true

# Declare default permissions as read only.
permissions: read-all

# Cancel any previously-started but still active runs on the same branch.
concurrency:
cancel-in-progress: true
group: ${{github.workflow}}-${{github.event.pull_request.number||github.ref}}

jobs:
update-citation-cff:
name: Update CITATION.cff file
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: write
env:
version_tag: ${{inputs.use_tag || github.event.release.tag_name}}
pub_date: ${{inputs.use_date || github.event.release.published_at}}
steps:
- if: ${{!env.version_tag || !env.pub_date}}
name: Quit if the release tag or publication date is empty
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
script: |
core.setFailed('The release version and/or date could not be read')

- name: Check out a copy of the git repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Verify that this repo has a CITATION.cff file
id: check
run: |
[[ -f CITATION.cff ]] && have_cff=true || have_cff=false
echo "has_cff_file=$have_cff" >> "$GITHUB_OUTPUT"

- if: steps.check.outputs.has_cff_file == 'false'
name: Quit if there is no CITATION.cff file
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
script: |
core.setFailed('Could not find a CITATION.cff file')

- name: Update the CITATION.cff file
id: update
run: |
echo "::group::CITATION.cff file before update"
cat CITATION.cff
echo "::endgroup::"

set -x
version="${{env.version_tag}}"
version="${version#v}"
date=$(date -u -d "${{env.pub_date}}" +"%Y-%m-%d")
sed -i "s/^version:.*$/version: '$version'/" CITATION.cff
sed -i "s/^date-released:.*$/date-released: $date/" CITATION.cff

# Sanity-check that the result looks valid.
success=true
yamllint CITATION.cff > /dev/null 2>&1 || success=false
written_version=$(yq -r .version CITATION.cff)
[[ "$version" == "$written_version" ]] || success=false
echo "success=$success" >> "$GITHUB_OUTPUT"

echo "::group::CITATION.cff file after update"
cat CITATION.cff
echo "::endgroup::"

- if: steps.update.outputs.success == 'false'
name: Quit if CITATION.cff update failed
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
script: |
core.setFailed('CITATION.cff update failed or the file is not valid')

- if: steps.update.outputs.success == 'true'
name: Commit the updated CITATION.cff back to the repo
uses: EndBug/add-and-commit@a94899bca583c204427a224a7af87c02f9b325d5 # v9
with:
add: CITATION.cff
message: 'Update version and date in CITATION.cff file'
48 changes: 39 additions & 9 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,32 +1,62 @@
# Citation information for this repository. -*- yaml -*-
#
# CITATION.cff files provide human- & machine-readable citation information for
# software and datasets. GitHub, Zenodo, and the Zotero browser plugin all use
# CFF files automatically if provided. https://citation-file-format.github.io/.
#
# Tools exist to generate CITATION.cff files from other formats such as BibTeX.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

cff-version: 1.2.0
message: If you use this software, please cite it as below.
message: If you use this software, please cite it using this metadata.

title: Cirq
authors:
- name: Cirq Developers
website: https://github.com/quantumlib/Cirq/graphs/contributors
title: Cirq
abstract: Python package for writing, manipulating, and running quantum circuits on quantum computers and simulators.
abstract: >-
Python package for writing, manipulating, and running quantum circuits
on quantum computers and simulators.
version: 1.4.1
date-released: 2024-06-26
url: https://quantumai.google/cirq
repository-code: https://github.com/quantumlib/Cirq
license: Apache-2.0
identifiers:
- type: doi
- description: Archival DOI for Cirq software releases
value: 10.5281/zenodo.4062499
description: Archival DOI for Cirq software releases.
type: doi
- description: The home page for Cirq
value: https://quantumai.google/Cirq
type: url
- description: PyPI project for Cirq
value: https://pypi.org/project/Cirq
type: url
type: software
keywords:
- api
- nisq
- algorithms
- API
- application programming interface
- NISQ
- noisy intermediate-scale quantum
- python
- open-source software
- Python
- quantum
- quantum algorithms
- quantum circuit simulation
- quantum circuits
- quantum computer simulation
- quantum computing
- quantum information
- quantum programming
- quantum programming languages
- quantum simulation
- sdk
- qubit
- research
- science
- SDK
- simulation
- simulator
- software
- software development toolkit
- visualization
Loading