From 162d59e14a0f41eaa144d45765c461573b128d5b Mon Sep 17 00:00:00 2001 From: Martin Scheidt Date: Mon, 4 Apr 2022 11:01:51 +0200 Subject: [PATCH] enable zenodo upload --- .github/workflows/debug.yml | 3 +- .github/workflows/release.yaml | 56 +++++++++++++++++++++++++++++----- .github/workflows/zenodo.yaml | 9 ++++-- CITATION.cff | 4 +-- CONTRIBUTING.md | 4 +-- README.md | 2 +- build.sh | 47 ++++++++++++++++++++++------ 7 files changed, 99 insertions(+), 26 deletions(-) diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index c1a4218..7b41079 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -57,8 +57,9 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it uses: actions/checkout@v2 + # download artifact in folder artifact/ - uses: actions/download-artifact@v3 - id: download + - run: cd artifact # - name: "install ghostscript" # run: sudo apt-get install -y ghostscript diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 521b62a..ff740c2 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -48,12 +48,12 @@ jobs: # 6. upload artifact to share it with other jobs - uses: actions/upload-artifact@v3 with: - path: tikz-trackschematic-v0.7.0.zip + path: tikz-trackschematic-${{ steps.tag.outputs.tag }}.zip if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn` - uses: actions/upload-artifact@v3 with: - path: release-note-v0.7.0.md + path: release-note-${{ steps.tag.outputs.tag }}.md if-no-files-found: warn # 'error' or 'ignore' are also available, defaults to `warn` - uses: actions/upload-artifact@v3 @@ -71,7 +71,10 @@ jobs: name: "publish on github" runs-on: ubuntu-latest steps: - # 1. get varibale ${{ steps.tag.outputs.tag }} + # 1. download artifact in folder artifact/ + - uses: actions/download-artifact@v3 + + # 2. get varibale ${{ steps.tag.outputs.tag }} - name: "get tag" id: tag uses: dawidd6/action-get-tag@v1 @@ -79,9 +82,6 @@ jobs: # Optionally strip `v` prefix strip_v: false - # 2. download artifact in folder artifact/ - - uses: actions/download-artifact@v3 - # 3. publish package as new release on github - name: "create release" id: create_release @@ -119,6 +119,9 @@ jobs: steps: # 1. download artifact in folder artifact/ - uses: actions/download-artifact@v3 + - run: | + mv ./artifact/tikz-trackschematic-*.zip ./ + mv ./artifact/tikz-trackschematic.pkg ./ # 2. install ctan-o-mat - name: "setup TeX Live (via paolobrasolin)" @@ -129,4 +132,43 @@ jobs: # 3. upload new release to CTAN - name: CTAN submit - run: ctan-o-mat --verbose --submit artifact/tikz-trackschematic.pkg + run: ctan-o-mat --verbose --submit tikz-trackschematic.pkg + + publish_zenodo: + needs: create_package + name: "publish on zenodo sandbox" + runs-on: ubuntu-latest + steps: + # 1. get varibale ${{ steps.tag.outputs.tag }} + - name: "get tag" + id: tag + uses: dawidd6/action-get-tag@v1 + with: + # Optionally strip `v` prefix + strip_v: false + + # 2. checkout the repo for zenodraft/action@0.10.0 to work + - name: "checkout" + uses: actions/checkout@v2 + + # 3. download artifact in folder artifact/ and move it one level up + - uses: actions/download-artifact@v3 + - run: | + mv ./artifact/tikz-trackschematic-*.zip ./ + mv ./artifact/metadata.json ./ + + # 4. upload to zenodo + - name: "uploading to zenodo sandbox" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ZENODO_ACCESS_TOKEN: ${{ secrets.ZENODO_ACCESS_TOKEN }} + uses: zenodraft/action@0.10.0 + with: + collection: 5539844 + filenames: tikz-trackschematic-${{ steps.tag.outputs.tag }}.zip + upsert-doi: true + upsert-location: identifiers[1] + metadata: metadata.json + publish: true + sandbox: false + verbose: true \ No newline at end of file diff --git a/.github/workflows/zenodo.yaml b/.github/workflows/zenodo.yaml index 36911c6..73beba0 100644 --- a/.github/workflows/zenodo.yaml +++ b/.github/workflows/zenodo.yaml @@ -53,6 +53,9 @@ jobs: # download artifact in folder artifact/ - uses: actions/download-artifact@v3 + - run: | + mv ./artifact/tikz-trackschematic-*.zip ./ + mv ./artifact/metadata.json ./ - name: "uploading to zenodo sandbox" env: @@ -63,10 +66,10 @@ jobs: with: # collection: 5539844 collection: 1047380 - filenames: artifact/tikz-trackschematic-v0.7.0.zip + filenames: tikz-trackschematic-v0.7.0.zip upsert-doi: true - upsert-location: identifiers[2] - metadata: artifact/metadata.json + upsert-location: identifiers[1] + metadata: metadata.json publish: true sandbox: true verbose: true \ No newline at end of file diff --git a/CITATION.cff b/CITATION.cff index afaae38..48c6564 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -40,5 +40,5 @@ keywords: - tracks - schematics license: ISC -version: v0.6.3 -date-released: '2022-02-15' +version: v0.7.0 +date-released: '2022-04-02' diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8ae8272..9235556 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,9 +21,9 @@ Please note we have a code of conduct, please follow it in all your interactions 3. The versioning scheme we use is [SemVer](http://semver.org/). Increase the version numbers in the following files to the new version that this Pull Request would represent: 1. CHANGELOG.md 2. doc/versionhistory.tex + 3. CITATION.cff 4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you. 5. The following versioning steps will be taken care of by the maintainer: 1. git repo with tag - 2. CITATION.cff including DOI for current version - 3. sync Overleaf project + 2. sync Overleaf project diff --git a/README.md b/README.md index 8112549..ba15745 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # TikZ-trackschematic -[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5539844.svg)](https://doi.org/10.5281/zenodo.5539844) [![continuous integration test](https://github.com/railtoolkit/tikz-trackschematic/actions/workflows/testing.yml/badge.svg)](https://github.com/railtoolkit/tikz-trackschematic/actions/workflows/testing.yml) +[![License: ISC](https://img.shields.io/badge/license-ISC-green.svg)](https://opensource.org/licenses/ISC) [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5539844.svg)](https://doi.org/10.5281/zenodo.5539844) [![continuous integration test](https://github.com/railtoolkit/tikz-trackschematic/actions/workflows/testing.yml/badge.svg)](https://github.com/railtoolkit/tikz-trackschematic/actions/workflows/testing.yml) ------------ diff --git a/build.sh b/build.sh index 1fac1bf..5dff128 100755 --- a/build.sh +++ b/build.sh @@ -453,26 +453,52 @@ check_changelog() { exit 1 } +check_citation() { + # check if $VERSION is present in CITATION.cff + STATUS=0 + grep -qs "version: $VERSION_STR" CITATION.cff || STATUS=1 + if [ $STATUS = 0 ]; then + log_note "Version $VERSION_STR is present in CITATION.cff." + return 0 + fi + + log_error "Version $VERSION_STR not found in CITATION.cff. \ + Be sure to edit CITATION.cff and specify current version!" + exit 1 +} + check_date() { - ## extract DATE from versionhistory.tex and CHANGELOG.md + ## extract DATE from versionhistory.tex, CHANGELOG.md, and CITATION.cff + # fallback: DATE=$(date "+%Y-%m-%d") + # + STATUS=0 + # LINE_1=$(grep "vhEntry{$VERSION_NUM" doc/versionhistory.tex) LINE_2=$(grep "Version \[$VERSION_NUM\]" CHANGELOG.md) + LINE_3=$(grep "date-released:" CITATION.cff) DATEISO_1=$(echo $LINE_1 | egrep -o '[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])') DATEISO_2=$(echo $LINE_2 | egrep -o '[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])') + DATEISO_3=$(echo $LINE_3 | egrep -o '[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])') - if [ $DATEISO_1 = $DATEISO_2 ]; then - # DATE=$(date "+%Y-%m-%d") + if [ $DATEISO_1 != $DATEISO_2 ]; then + STATUS=1 + fi + if [ $DATEISO_1 != $DATEISO_3 ]; then + STATUS=1 + fi + + if [ $STATUS = 0 ]; then DATE="$DATEISO_1" log_note "The date $DATE was extracted from versionhistory.tex and CHANGELOG.md." return 0 fi - log_error "The date in versionhistory.tex and CHANGELOG.md did not match.\ - Be sure to edit versionhistory.tex or CHANGELOG.md and modifiy the date!" + log_error "The date in versionhistory.tex, CHANGELOG.md, and CITATION.cff did not match.\ + Be sure to edit versionhistory.tex, CHANGELOG.md, or CITATION.cff and modifiy the date!" exit 1 } -check_url1() { +check_changelog_url1() { ## extract urls from CHANGELOG.md STATUS=0 LINE=$(grep "\[$VERSION_NUM\]: https://" CHANGELOG.md) @@ -487,7 +513,7 @@ check_url1() { exit 1 } -check_url2() { +check_changelog_url2() { ## extract urls from CHANGELOG.md STATUS=0 LINE=$(grep "\[Unreleased\]: https://" CHANGELOG.md) @@ -1049,11 +1075,12 @@ if [ $RELEASE = 1 ]; then ## check if version ist in the correct format check_version_number - ## check if $VERSION is present in CHANGELOG.md and versionhistory.tex + ## check if $VERSION is present in CHANGELOG.md, versionhistory.tex, and CITATION.cff check_versionhistory check_changelog - check_url1 - check_url2 + check_changelog_url1 + check_changelog_url2 + check_citation check_date ## check for installed software