diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 28058e3..1b540a7 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/README.md b/README.md index 0ed99da..a217b37 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,9 @@ cldfbench zenodo --communities dplace cldfbench_.py cldfbench cldfviz.map cldf --pacific-centered --format png --width 20 --output map.png --with-ocean --no-legend cldfbench readme cldfbench_.py dplace check cldfbench_.py -git commit -a -m"release vX.Y" +git commit -a -m"release v3.0" git push origin +dplace release cldfbench_.py v3.0 ``` Then create a release on GitHub, thereby pushing the repos to Zenodo. diff --git a/src/pydplace/commands/release.py b/src/pydplace/commands/release.py new file mode 100644 index 0000000..5f8733b --- /dev/null +++ b/src/pydplace/commands/release.py @@ -0,0 +1,42 @@ +""" + +""" +from cldfbench.cli_util import add_dataset_spec, get_dataset + + +def register(parser): + add_dataset_spec(parser) + parser.add_argument('tag') + + +def run(args): # pragma: no cover + tag = args.tag + if not tag.startswith('v'): + tag = 'v' + tag + ds = get_dataset(args) + cldf = ds.cldf_reader() + if cldf.properties.get('dc:bibliographicCitation'): + relnotes = """\ +Cite the source as + +> {} + +and the D-PLACE dataset as + +DOI""".format(cldf.properties['dc:bibliographicCitation']) + else: + relnotes = """\ +Cite the D-PLACE dataset as + +DOI""" + + ds.dir.joinpath('relnotes.txt').write_text(relnotes, encoding='utf8') + print('gh release create {} --title "{}" --notes-file relnotes.txt'.format( + tag, cldf.properties['dc:title'])) + print('git pull origin') + print('') + print("Now you should grab the Zenodo version DOI from\n" + "https://zenodo.org/account/settings/github/repository/D-PLACE/{0}\n" + "and add it to\n" + "https://github.com/D-PLACE/{0}/releases/edit/{1}\n and the concept DOI to " + "metdata.json".format(cldf.properties['rdf:ID'], tag)) diff --git a/src/pydplace/dataset.py b/src/pydplace/dataset.py index 01de53d..cc44e6e 100644 --- a/src/pydplace/dataset.py +++ b/src/pydplace/dataset.py @@ -285,6 +285,12 @@ def add_society(self, writer, **props): ) writer.objects['LanguageTable'].append(props) + def local_makecldf(self, args): + """ + Datasets can hook up any custom processing to happen at the end of the CLDF conversion. + """ + pass + def cmd_makecldf(self, args): data_schema(args.writer.cldf) self.schema(args.writer.cldf) @@ -309,6 +315,7 @@ def cmd_makecldf(self, args): comment=row['Comment'], glottocode_comment=row['glottocode_comment'], ) + self.local_makecldf(args) def cmd_readme(self, args): print('gh repo edit --description "{}" --add-topic "ethnology"'.format(self.metadata.title))