Compare commits

...

10 Commits

Author SHA1 Message Date
Martin Scheidt 48794dd20c updated DOI 2022-04-06 16:50:15 +02:00
Martin Scheidt 0b1a14fbc9 zenodo upload with CLI zenodraft 2022-04-06 16:30:05 +02:00
Martin Scheidt bdf679986e Merge pull request #31 from jspaaks/master
changed some metadata properties to be able to publish on Zenodo
2022-04-05 10:33:58 +02:00
Jurriaan H. Spaaks 3eef5a1e18 changed some metadata properties to be able to publish on Zenodo 2022-04-04 17:42:37 +02:00
Martin Scheidt 162d59e14a enable zenodo upload 2022-04-04 14:31:32 +02:00
Martin Scheidt ae8ed95aee restructured github actions 2022-04-03 12:43:28 +02:00
Martin Scheidt ac3e664ae6 added DOI 2022-04-01 16:10:16 +02:00
Martin Scheidt e64e57d728 switch for automated CTAN upload to ctan-o-mat 2022-03-30 21:39:47 +02:00
Martin Scheidt 2683bf27c2 fixed bad substitution in shell script 2022-03-29 14:33:03 +02:00
Martin Scheidt c159bb00a2 Added test for automated CTAN upload 2022-03-29 14:22:56 +02:00
12 changed files with 562 additions and 57 deletions

2
.github/tex/packages.upload.txt vendored Normal file
View File

@ -0,0 +1,2 @@
## -- upload
ctan-o-mat

125
.github/tex/tikz-trackschematic.pkg vendored Normal file
View File

@ -0,0 +1,125 @@
% This is a description file for ctan-o-mat.
% It manages uploads of a package to
% CTAN -- the Comprehensive TeX Archive Network.
%
% The syntax is roughly oriented towards (La)TeX.
% Two form of the macros are used. The simple macros take one argument
% in braces. Here the argument may not contain embedded macros.
%
% The second form uses an environment enclosed in \begin{}/\end{}.
% In the long text fields logo macros can be used.
%
% You should enter your values between the begin and the end of the
% named type.
% -------------------------------------------------------------------------
% This field contains the CTAN id of the package.
% The value is optional.
% The value is restricted to 32 characters.
\pkg{tikz-trackschematic}
% -------------------------------------------------------------------------
% This field contains the version of the package.
% The value is optional.
% The value is restricted to 32 characters.
\version{}%%[SCRIPT]
% -------------------------------------------------------------------------
% This field contains the name of the author(s).
% The value is optional.
% The value is restricted to 128 characters.
\author{Martin Scheidt}
% -------------------------------------------------------------------------
% This field contains the email address of the uploader.
% The value is an email address.
% The value is restricted to 255 characters.
\email{m.scheidt@tu-braunschweig.de}
% -------------------------------------------------------------------------
% This field contains the name of the uploader.
% The value is restricted to 255 characters.
\uploader{Martin Scheidt (via github actions)}
% -------------------------------------------------------------------------
% This field contains the directory on CTAN.
% The value is optional.
% The value is restricted to 255 characters.
\ctanPath{/graphics/pgf/contrib/tikz-trackschematic}
% -------------------------------------------------------------------------
% This field contains the license.
% The value is optional.
% The value is restricted to 2048 characters.
% Multiple values are allowed.
\license{isc}
% -------------------------------------------------------------------------
% This field contains the URL of the home page.
% The value is optional.
% The value is a URL.
% The value is restricted to 255 characters.
% Multiple values are allowed.
\home{https://www.railtoolkit.org/projects/tikz-trackschematic/}
% -------------------------------------------------------------------------
% This field contains the URL of the bug tracker.
% The value is optional.
% The value is a URL.
% The value is restricted to 255 characters.
% Multiple values are allowed.
\bugtracker{https://github.com/railtoolkit/tikz-trackschematic/issues}
% -------------------------------------------------------------------------
% This field contains the support channel.
% The value is optional.
% The value is a URL.
% The value is restricted to 255 characters.
% Multiple values are allowed.
\support{}
% -------------------------------------------------------------------------
% This field contains the version management.
% The value is optional.
% The value is a URL.
% The value is restricted to 255 characters.
% Multiple values are allowed.
\repository{https://github.com/railtoolkit/tikz-trackschematic}
% -------------------------------------------------------------------------
% This field contains the developer's channel.
% The value is optional.
% The value is a URL.
% The value is restricted to 255 characters.
% Multiple values are allowed.
\development{}
% -------------------------------------------------------------------------
% This field contains the update indicator; true for update.
% The value is optional.
% The value is restricted to 8 characters.
\update{true}
% -------------------------------------------------------------------------
% This field contains the topics id.
% The value is optional.
% The value is restricted to 1024 characters.
% Multiple values are allowed.
\topic{}
% -------------------------------------------------------------------------
% This field contains the text for the mail announcement.
% The value is optional.
% The value is restricted to 8192 characters.
\begin{announcement}
%RELEASE-NOTES%%[SCRIPT]
\end{announcement}
% -------------------------------------------------------------------------
% This field contains the one-liner for the package.
% The value is optional.
% The value is restricted to 128 characters.
\summary{A TikZ library for creating track diagrams in railways}
% -------------------------------------------------------------------------
% This field contains the descriptive abstract for the package.
% The value is optional.
% The value is restricted to 4096 characters.
\begin{description}
This TikZ library is a toolbox of symbols geared primarily towards creating track schematic for either research or educational purposes. It provides a TikZ frontend to some of the symbols which may be needed to describe situations and layouts in railway operation. The library is divided into sublibraries: topology, trafficcontrol, vehicles, constructions, electrics, symbology, and measures.
\end{description}
% -------------------------------------------------------------------------
% This field contains the note to the CTAN upload managers.
% The value is optional.
% The value is restricted to 2048 characters.
\begin{note}
Uploaded automatically by ctan-o-mat (via github actions)
\end{note}
% -------------------------------------------------------------------------
% This field contains the archive file.
% The value is the file name of the archive to be uploaded.
% It may have a relative or absolute directory.
\file{}%%[SCRIPT]

View File

@ -12,8 +12,42 @@ on:
## A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
create_package:
name: "create a TeX Live package"
runs-on: ubuntu-latest
steps:
# checkout the repo
- name: "checkout"
uses: actions/checkout@v2
# create package and release notes
- name: "create tikz-trackschematic package"
run: ./build.sh --non-interactive --release v0.7.0
# upload artifact two share it with other jobs
- uses: actions/upload-artifact@v3
with:
path: tikz-trackschematic-v0.7.0.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
if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn`
- uses: actions/upload-artifact@v3
with:
path: .github/tex/tikz-trackschematic.pkg
if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn`
- uses: actions/upload-artifact@v3
with:
path: .github/zenodo/metadata.json
if-no-files-found: warn # 'warn' or 'ignore' are also available, defaults to `warn`
# This workflow contains a single job called "build"
debug:
needs: create_package
# The type of runner that the job will run on
runs-on: ubuntu-latest
@ -23,8 +57,11 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
uses: actions/checkout@v2
- name: "install ghostscript"
run: sudo apt-get install -y ghostscript
# download artifact in folder artifact/
- uses: actions/download-artifact@v3
# - name: "install ghostscript"
# run: sudo apt-get install -y ghostscript
###### multiple options for a TeX environment
# ##
@ -45,11 +82,11 @@ jobs:
# with:
# package-file: .github/tex/packages.test.txt
# ##
- name: "setup TeX Live (via paolobrasolin)"
uses: paolobrasolin/setup-texlive-action@v1
with:
profile-path: ${{ github.workspace }}/.github/tex/profile.minimal.txt
packages-path: ${{ github.workspace }}/.github/tex/packages.doc.txt
# - name: "setup TeX Live (via paolobrasolin)"
# uses: paolobrasolin/setup-texlive-action@v1
# with:
# profile-path: ${{ github.workspace }}/.github/tex/profile.minimal.txt
# packages-path: ${{ github.workspace }}/.github/tex/packages.doc.txt
# - name: "install tikz-trackschematic"
# run: ./build.sh --non-interactive --install-dev
@ -70,6 +107,9 @@ jobs:
## opening a debug console
- name: Setup upterm session
env:
# ZENODO_ACCESS_TOKEN: ${{ secrets.ZENODO_ACCESS_TOKEN }}
ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
uses: lhotari/action-upterm@v1
with:
limit-access-to-actor: true

View File

@ -11,14 +11,25 @@ on:
## A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
release:
create_package:
name: "create a TeX Live package for tikz-trackschematic"
outputs:
version: ${{ steps.tag.outputs.tag }}
runs-on: ubuntu-latest
steps:
# 1. checkout the repo
# 1. get varibale tag and put it in ${{ 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
- name: "checkout"
uses: actions/checkout@v2
# 2. install TeX Live
# 3. install TeX Live
- name: "install ghostscript"
run: sudo apt-get install -y ghostscript
@ -28,23 +39,39 @@ jobs:
profile-path: ${{ github.workspace }}/.github/tex/profile.minimal.txt
packages-path: ${{ github.workspace }}/.github/tex/packages.doc.txt
# 3. (re-)compile the documentation
# 4. (re-)compile the documentation
- name: "update tikz-trackschematic documentation before release"
run: ./build.sh --non-interactive --memory-increase --compile-doc
# 4. create package and release notes
## 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
# 5. create package and release notes
- name: "create tikz-trackschematic package"
run: ./build.sh --non-interactive --release ${{ steps.tag.outputs.tag }}
# 5. publish package as new release on github
# 6. upload artifact to share it with other jobs
- uses: actions/upload-artifact@v3
with:
path: |
tikz-trackschematic-${{ steps.tag.outputs.tag }}.zip
release-note-${{ steps.tag.outputs.tag }}.md
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
- uses: actions/upload-artifact@v3
with:
path: .github/tex/tikz-trackschematic.pkg
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
- uses: actions/upload-artifact@v3
with:
path: .github/zenodo/metadata.json
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
publish_github:
needs: create_package
name: "publish on github"
runs-on: ubuntu-latest
steps:
# 1. download artifact in folder artifact/
- uses: actions/download-artifact@v3
# 2. creating a new release
- name: "create release"
id: create_release
uses: actions/create-release@v1
@ -53,20 +80,22 @@ jobs:
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: release-note-${{ steps.tag.outputs.tag }}.md
body_path: artifact/release-note-${{needs.create_package.outputs.version}}.md
draft: false
prerelease: false
# 3. upload package to new release
- name: "upload release asset"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: tikz-trackschematic-${{ steps.tag.outputs.tag }}.zip
asset_name: tikz-trackschematic-${{ steps.tag.outputs.tag }}.zip
asset_path: artifact/tikz-trackschematic-${{needs.create_package.outputs.version}}.zip
asset_name: tikz-trackschematic-${{needs.create_package.outputs.version}}.zip
asset_content_type: application/zip
# 4. publish release on github
- name: "publish release"
uses: StuYarrow/publish-release@v1
env:
@ -74,5 +103,73 @@ jobs:
with:
id: ${{ steps.create_release.outputs.id }}
# 6. upload new release to CTAN
## TODO
publish_CTAN:
needs: create_package
name: "publish on CTAN"
runs-on: ubuntu-latest
steps:
# 1. download artifact in folder artifact/ and move it one level up
- uses: actions/download-artifact@v3
- run: |
mv ./artifact/tikz-trackschematic-*.zip ./
# 2. install ctan-o-mat
- name: "setup TeX Live (via paolobrasolin)"
uses: paolobrasolin/setup-texlive-action@v1
with:
profile-path: ${{ github.workspace }}/.github/tex/profile.minimal.txt
packages-path: ${{ github.workspace }}/.github/tex/packages.upload.txt
# 3. upload new release to CTAN
- name: CTAN submit
run: ctan-o-mat --verbose --submit artifact/tikz-trackschematic.pkg
publish_zenodo:
needs: create_package
name: "publish on zenodo"
outputs:
doi: ${{ steps.zenodraft.outputs.doi }}
runs-on: ubuntu-latest
steps:
# 1. download artifact in folder artifact/ and move it one level up
- uses: actions/download-artifact@v3
- run: |
mv ./artifact/tikz-trackschematic-*.zip ./
# 2. install zenodraft
- name: "install zenodraft"
run: npm install -g zenodraft
# 3. upload new release to zenodo
- name: "uploading to zenodo"
id: zenodraft
env:
ZENODO_ACCESS_TOKEN: ${{ secrets.ZENODO_ACCESS_TOKEN }}
COLLECTION: 5539844
run: |
ID=$(zenodraft deposition create in-existing-collection $COLLECTION)
zenodraft file add $ID tikz-trackschematic-*.zip
zenodraft metadata update $ID artifact/metadata.json
zenodraft deposition publish $ID
echo "::set-output name=doi::$(zenodraft deposition show prereserved $ID)"
update_citation:
needs: publish_zenodo
name: "updates CITATION.cff"
runs-on: ubuntu-latest
steps:
# 1. checkout the repo for zenodraft/action@0.10.0 to work
- name: "checkout"
uses: actions/checkout@v2
- run: ./build.sh --update-cite ${{needs.publish_zenodo.outputs.doi}}
- name: push
uses: github-actions-x/commit@v2.8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
push-branch: 'master'
force-add: 'true'
files: CITATION.cff
commit-message: 'updated DOI (via github action)'
rebase: 'true' # pull and rebase before commit

View File

@ -1,6 +1,6 @@
# This is a basic workflow to help you get started with Actions
name: test
name: "continuous integration test"
# Controls when the workflow will run
on:
@ -32,7 +32,7 @@ jobs:
- name: "setup TeX Live (via paolobrasolin)"
uses: paolobrasolin/setup-texlive-action@v1
with:
profile-path: ${{ github.workspace }}/.github/tex/profile.minimal.txt
profile-path: ${{ github.workspace }}/.github/tex/profile.basic.txt
packages-path: ${{ github.workspace }}/.github/tex/packages.test.txt
- name: "test tikz-trackschematic"

126
.github/workflows/zenodo.yaml vendored Normal file
View File

@ -0,0 +1,126 @@
name: zenodo sandbox test
on:
# # Trigger when you publish a release via GitHub's release page
# release:
# types:
# - published
# # Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
create_package:
name: "create a TeX Live package"
outputs:
version: ${{ steps.tag.outputs.tag }}
runs-on: ubuntu-latest
steps:
# set varibale ${{ steps.tag.outputs.tag }}
- name: "get tag"
id: tag
run: echo "::set-output name=tag::v0.7.0"
# checkout the repo
- name: "checkout"
uses: actions/checkout@v2
# create package and release notes
- name: "create tikz-trackschematic package"
run: ./build.sh --non-interactive --release ${{ steps.tag.outputs.tag }}
# upload artifact to share it with other jobs
- uses: actions/upload-artifact@v3
with:
path: |
tikz-trackschematic-${{ steps.tag.outputs.tag }}.zip
release-note-${{ steps.tag.outputs.tag }}.md
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
- uses: actions/upload-artifact@v3
with:
path: .github/tex/tikz-trackschematic.pkg
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
- uses: actions/upload-artifact@v3
with:
path: .github/zenodo/metadata.json
if-no-files-found: error # 'warn' or 'ignore' are also available, defaults to `warn`
# publish_zenodo:
# needs: create_package
# name: "publish on zenodo sandbox"
# runs-on: ubuntu-latest
# steps:
# # checkout the repo
# - name: "checkout"
# uses: actions/checkout@v2
# # 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:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# # ZENODO_ACCESS_TOKEN: ${{ secrets.ZENODO_ACCESS_TOKEN }}
# ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
# uses: zenodraft/action@0.10.0
# with:
# # collection: 5539844
# collection: 1047380
# filenames: tikz-trackschematic-v0.7.0.zip
# upsert-doi: true
# upsert-location: identifiers[1]
# metadata: metadata.json
# publish: true
# sandbox: true
# verbose: true
publish_zenodo:
needs: create_package
name: "publish on zenodo sandbox"
outputs:
doi: ${{ steps.zenodraft.outputs.doi }}
runs-on: ubuntu-latest
steps:
# download artifact in folder artifact/
- uses: actions/download-artifact@v3
- run: |
mv ./artifact/tikz-trackschematic-${{needs.create_package.outputs.version}}.zip ./
- name: "install zenodraft"
run: npm install -g zenodraft
- name: "uploading to zenodo sandbox"
id: zenodraft
env:
ZENODO_SANDBOX_ACCESS_TOKEN: ${{ secrets.ZENODO_SANDBOX_ACCESS_TOKEN }}
COLLECTION: 1047380
run: |
ID=$(zenodraft --sandbox deposition create in-existing-collection $COLLECTION)
zenodraft --sandbox file add $ID tikz-trackschematic-*.zip
zenodraft --sandbox metadata update $ID artifact/metadata.json
zenodraft --sandbox deposition publish $ID
echo "::set-output name=doi::$(zenodraft --sandbox deposition show prereserved $ID)"
update_citation:
needs: publish_zenodo
name: "updates CITATION.cff"
runs-on: ubuntu-latest
steps:
# 1. checkout the repo for zenodraft/action@0.10.0 to work
- name: "checkout"
uses: actions/checkout@v2
- run: ./build.sh --update-cite ${{needs.publish_zenodo.outputs.doi}}
- name: push
uses: github-actions-x/commit@v2.8
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
push-branch: 'github-action'
force-add: 'true'
files: CITATION.cff
commit-message: 'updated DOI (via github action)'
name: Martin Scheidt
email: m.scheidt@tu-bs.de

27
.github/zenodo/metadata.json vendored Normal file
View File

@ -0,0 +1,27 @@
{
"title": "TikZ-trackschematic",
"version": "%%[SCRIPT]",
"publication_date": "%%[SCRIPT]",
"creators": [
{
"orcid": "0000-0002-9384-8945",
"affiliation": "TU Braunschweig",
"name": "Scheidt, Martin"
}
],
"description": "A TikZ library for creating track diagrams in railways. The TikZ-trackschematic library is a toolbox of symbols geared primarily towards creating track schematic for either research or educational purposes. It provides a TikZ frontend to some of the symbols which maybe needed to describe situations and layouts in railway operation.",
"keywords": [
"tex",
"tikz",
"railway",
"railroad",
"tracks",
"schematics"
],
"license": {
"id": "ISC"
},
"language": "eng",
"access_right": "open",
"upload_type": "software"
}

1
.gitignore vendored
View File

@ -277,5 +277,6 @@ Temporary Items
.apdisk
# Archives for upload
artifact
tikz-trackschematic-*.zip
release-note-*.md

View File

@ -17,7 +17,7 @@ identifiers:
value: 10.5281/zenodo.5539844
description: 'Collection of archived snapshots of all versions of the library'
- type: doi
value: 10.5281/zenodo.6222186
value: 10.5281/zenodo.6418404
description: Current version
url: 'https://www.railtoolkit.org/projects/tikz-trackschematic/'
repository: 'https://github.com/railtoolkit/tikz-trackschematic'
@ -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

View File

@ -25,5 +25,4 @@ Please note we have a code of conduct, please follow it in all your interactions
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

View File

@ -1,5 +1,7 @@
# TikZ-trackschematic
[![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)
------------
# Installation

130
build.sh
View File

@ -48,6 +48,8 @@ install, test or release a package for tikz-trackschematic
-r, --release VERSION Creates a .zip with the release for given VERSION in
Semantic Versioning with leading 'v', e.g: v1.0.0
-z, --update-cite DOI Updates the CITATION.cff with the current version in
CHANGELOG.md and a given DOI
EOF
}
@ -60,6 +62,7 @@ TESTING=0 # set by cli argument
COMPILE=0 # set by cli argument
SYMBOLOGY=0 # set by cli argument
RELEASE=0 # set by cli argument
CITATION=0 # set by cli argument
CLEANUP=1 # set by cli argument
process_arguments() {
@ -108,12 +111,21 @@ process_arguments() {
-r|--release)
RELEASE=1
shift
if [ -z "$1" ] || [ "${1:0:1}" = "-" ]; then
if [ -z "$1" ] || [ "`echo $1 | cut -c1-1`" = "-" ]; then
print_usage
exit 1
fi
VERSION_STR=$1
;;
-z|--update-cite)
CITATION=1
shift
if [ -z "$1" ] || [ "`echo $1 | cut -c1-1`" = "-" ]; then
print_usage
exit 1
fi
DOI=$1
;;
*)
print_usage
exit 1
@ -454,25 +466,37 @@ check_changelog() {
}
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 +511,7 @@ check_url1() {
exit 1
}
check_url2() {
check_changelog_url2() {
## extract urls from CHANGELOG.md
STATUS=0
LINE=$(grep "\[Unreleased\]: https://" CHANGELOG.md)
@ -568,8 +592,8 @@ create_release_notes() {
## -- create release note as excerpt from CHANGELOG.md
# determine beginning and end in CHANGELOG.md
TOP=$(grep -n "Version \[$VERSION_NUM\]" CHANGELOG.md | cut -d: -f1)
awk "NR>$TOP" CHANGELOG.md > release-note-tmp.md
BOTTOM=$(grep -n -m 1 "## Version" release-note-tmp.md | cut -d: -f1)
awk "NR>$TOP" CHANGELOG.md > release-note.tmp.md
BOTTOM=$(grep -n -m 1 "## Version" release-note.tmp.md | cut -d: -f1)
BOTTOM=$(( $TOP + $BOTTOM ))
BOTTOM=$(( $BOTTOM - 2 ))
TOP=$(( $TOP + 1 ))
@ -578,6 +602,28 @@ create_release_notes() {
sedi "s/###/##/g" release-note-$VERSION_STR.md
}
create_ctan_configuration() {
# modify the file .github/tex/tikz-trackschematic.pkg for ctan-o-mat
# 1. replace \version{}%%[SCRIPT]
sed -i".backup" -e"s/version{}%%\[SCRIPT\]/version{$DATE $VERSION_STR}/g" .github/tex/tikz-trackschematic.pkg
# 2. replace \file{}%%[SCRIPT]
sedi "s/file{}%%\[SCRIPT\]/file{tikz-trackschematic-$VERSION_STR.zip}/g" .github/tex/tikz-trackschematic.pkg
# 3. replace %RELEASE-NOTES%%[SCRIPT]
awk '/%RELEASE-NOTES%%\[SCRIPT\]/{system("cat release-note-*.md");next}1' .github/tex/tikz-trackschematic.pkg > .github/tex/tikz-trackschematic.tmp.pkg
mv .github/tex/tikz-trackschematic.tmp.pkg .github/tex/tikz-trackschematic.pkg
}
create_zenodo_metadata() {
# modify the file .github/zenodo/metadata.json for zenodo upload
# 1. replace "version": "%%[SCRIPT]"
sed -i".backup" -e"s/\"version\": \"%%\[SCRIPT\]\"/\"version\": \"$VERSION_STR\"/g" .github/zenodo/metadata.json
# 2. replace "publication_date": "%%[SCRIPT]"
sedi "s/\"publication_date\": \"%%\[SCRIPT\]\"/\"publication_date\": \"$DATE\"/g" .github/zenodo/metadata.json
}
run_compile_documentation() {
## compile order
# 1. manual, symbology-table, snippets
@ -905,17 +951,42 @@ change_tex_memory() {
fi
}
update_citation() {
## use CHANGELOG.md as source for $VERSION and $DATE
CHANGELOG_LINE=$(grep "Version \[" CHANGELOG.md | awk "NR==1")
VERSION=$(echo $CHANGELOG_LINE | egrep -o '(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)?')
DATE=$(echo $CHANGELOG_LINE | egrep -o '[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])')
## check for already made changes
STATUS=0
grep -qs "version: v$VERSION" CITATION.cff || STATUS=1
if [ $STATUS = 0 ]; then
log_note "CITATION.cff is already up to date!"
return 0
fi
## find lines in CITATION.cff
VERSION_LINE=$(grep -n 'version: v' CITATION.cff | cut -d: -f1)
DATE_LINE=$(grep -n 'date-released:' CITATION.cff | cut -d: -f1)
# select the second DOI
DOI_LINE=$(grep -n 'type: doi' CITATION.cff | cut -d: -f1 | awk "NR==2")
DOI_LINE=$(( $DOI_LINE + 1 ))
## update CITATION.cff
sedi "${VERSION_LINE}s|.*|version: v${VERSION}|" CITATION.cff
sedi "${DATE_LINE}s|.*|date-released: ${DATE}|" CITATION.cff
sedi "${DOI_LINE}s|.*| value: ${DOI}|" CITATION.cff
}
cleanup() {
## -- cleanup
## from create_release
if [ $CLEANUP = 1 ]; then
if [ $RELEASE = 1 ]; then
## from run_test_cases
if [ $TESTING = 1 ]; then
# remove TMP-folder
rm -rf $TMP
# undo changes to tikz-trackschematic.sty by sed
mv src/tikz-trackschematic.sty.backup src/tikz-trackschematic.sty
# remove TMP-release-note
rm release-note-tmp.md
rm -rf test/.tex
fi
## from check_imagemagick_policy
@ -938,10 +1009,18 @@ cleanup() {
rm doc/symbology/tmp.tex
fi
## from run_test_cases
if [ $TESTING = 1 ]; then
## from create_release(_notes)
if [ $RELEASE = 1 ]; then
# remove TMP-folder
rm -rf test/.tex
rm -rf $TMP
# undo changes to tikz-trackschematic.sty by sed
mv src/tikz-trackschematic.sty.backup src/tikz-trackschematic.sty
# remove TMP-release-note
rm release-note.tmp.md
# # undo changes to .github/tex/tikz-trackschematic.pkg by sed
# mv .github/tex/tikz-trackschematic.pkg.backup .github/tex/tikz-trackschematic.pkg
# # undo changes to .github/zenodo/metadata.json by sed
# mv .github/zenodo/metadata.json.backup .github/zenodo/metadata.json
fi
##
@ -1021,11 +1100,11 @@ 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_date
## check for installed software
@ -1034,6 +1113,13 @@ if [ $RELEASE = 1 ]; then
##
create_release
create_release_notes
create_ctan_configuration
create_zenodo_metadata
fi
if [ $CITATION = 1 ]; then
##
update_citation
fi
##