modified release script for automated releases

master
Martin Scheidt 2022-02-13 19:47:16 +01:00
parent bafeb79b2d
commit 585439d473
15 changed files with 302 additions and 61 deletions

13
.github/tex/profile.basic.txt vendored Normal file
View File

@ -0,0 +1,13 @@
# .github/tex/basic.profile.txt
# used for paolobrasolin/setup-texlive-action@v1
# Install the scheme:
#
# basic scheme (<minimal> and latex)
#
selected_scheme scheme-basic
# Omit documentation files:
tlpdbopt_install_docfiles 0
# Omit source files:
tlpdbopt_install_srcfiles 0
# Avoid doing backups:
tlpdbopt_autobackup 0

13
.github/tex/profile.full.txt vendored Normal file
View File

@ -0,0 +1,13 @@
# .github/tex/full.profile.txt
# used for paolobrasolin/setup-texlive-action@v1
# Install the scheme:
#
# full scheme (everything)
#
selected_scheme scheme-full
# Omit documentation files:
tlpdbopt_install_docfiles 0
# Omit source files:
tlpdbopt_install_srcfiles 0
# Avoid doing backups:
tlpdbopt_autobackup 0

13
.github/tex/profile.medium.txt vendored Normal file
View File

@ -0,0 +1,13 @@
# .github/tex/medium.profile.txt
# used for paolobrasolin/setup-texlive-action@v1
# Install the scheme:
#
# medium scheme (<small> + more packages and languages)
#
selected_scheme scheme-medium
# Omit documentation files:
tlpdbopt_install_docfiles 0
# Omit source files:
tlpdbopt_install_srcfiles 0
# Avoid doing backups:
tlpdbopt_autobackup 0

13
.github/tex/profile.minimal.txt vendored Normal file
View File

@ -0,0 +1,13 @@
# .github/tex/minimal.profile.txt
# used for paolobrasolin/setup-texlive-action@v1
# Install the scheme:
#
# minimal scheme (plain only)
#
selected_scheme scheme-minimal
# Omit documentation files:
tlpdbopt_install_docfiles 0
# Omit source files:
tlpdbopt_install_srcfiles 0
# Avoid doing backups:
tlpdbopt_autobackup 0

13
.github/tex/profile.small.txt vendored Normal file
View File

@ -0,0 +1,13 @@
# .github/tex/small.profile.txt
# used for paolobrasolin/setup-texlive-action@v1
# Install the scheme:
#
# small scheme (<basic> + xetex, metapost, and a few languages)
#
selected_scheme scheme-small
# Omit documentation files:
tlpdbopt_install_docfiles 0
# Omit source files:
tlpdbopt_install_srcfiles 0
# Avoid doing backups:
tlpdbopt_autobackup 0

View File

@ -1,9 +0,0 @@
# .github/texlive.profile
# Install the scheme minimal:
selected_scheme scheme-minimal
# Omit documentation files:
tlpdbopt_install_docfiles 0
# Omit source files:
tlpdbopt_install_srcfiles 0
# Avoid doing backups:
tlpdbopt_autobackup 0

View File

@ -40,19 +40,19 @@ jobs:
# # old TeX Live version: 2019
# uses: DanySK/setup-texlive-action@master
# with:
# requirements-file: .github/tex/packages.test.txt
# requirements-file: .github/tex/test.packages.txt
# ##
# - name: "setup TeX Live (via teatimeguest)"
# # tlmgr needs updates and fails
# uses: teatimeguest/setup-texlive-action@v1
# with:
# package-file: .github/tex/packages.test.txt
# package-file: .github/tex/test.packages.txt
# ##
- name: "setup TeX Live (via paolobrasolin)"
uses: paolobrasolin/setup-texlive-action@v1
with:
profile-path: ${{ github.workspace }}/.github/tex/texlive.profile.txt
packages-path: ${{ github.workspace }}/.github/tex/packages.test.txt
profile-path: ${{ github.workspace }}/.github/tex/minimal.profile.txt
packages-path: ${{ github.workspace }}/.github/tex/test.packages.txt
- name: "install tikz-trackschematic"
run: chmod +x dev-install.sh && ./dev-install.sh -b

89
.github/workflows/release.yaml vendored Normal file
View File

@ -0,0 +1,89 @@
name: "release"
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
tags:
- "v*"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test:
name: "test"
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
- name: "checkout"
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
uses: actions/checkout@v2
- name: "change ImageMagick policy to allow pdf->png conversion"
run: sudo sed -i 's/^.*policy.*coder.*none.*PDF.*//' /etc/ImageMagick-6/policy.xml
- name: "install ghostscript"
run: sudo apt-get install -y ghostscript
- name: "setup TeX Live (via paolobrasolin)"
uses: paolobrasolin/setup-texlive-action@v1
with:
profile-path: ${{ github.workspace }}/.github/tex/minimal.profile.txt
packages-path: ${{ github.workspace }}/.github/tex/test.packages.txt
- name: "install tikz-trackschematic"
run: chmod +x dev-install.sh && ./dev-install.sh -b
- name: "test tikz-trackschematic"
run: cd test && chmod +x testing.sh && ./testing.sh
release:
needs: test
name: "make release"
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
- name: "checkout"
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
uses: actions/checkout@v2
- name: "create tikz-trackschematic package"
env:
TAG_NAME: ${{ contains(github.event.head_commit.message, '[commit var]') }}
run: chmod +x create-release.sh ./create-release.sh -v ${TAG_NAME}
- name: "create release"
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Changes in this Release
- First Change
- Second Change
draft: false
prerelease: false
- 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-${TAG_NAME}.zip
asset_name: tikz-trackschematic-${TAG_NAME}.zip
asset_content_type: application/zip
- name: "publish release"
uses: StuYarrow/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
id: ${{ steps.create_release.outputs.id }}

View File

@ -33,8 +33,8 @@ jobs:
- name: "setup TeX Live (via paolobrasolin)"
uses: paolobrasolin/setup-texlive-action@v1
with:
profile-path: ${{ github.workspace }}/.github/tex/texlive.profile.txt
packages-path: ${{ github.workspace }}/.github/tex/packages.test.txt
profile-path: ${{ github.workspace }}/.github/tex/minimal.profile.txt
packages-path: ${{ github.workspace }}/.github/tex/test.packages.txt
- name: "install tikz-trackschematic"
run: chmod +x dev-install.sh && ./dev-install.sh -b

View File

@ -13,8 +13,7 @@ Please note we have a code of conduct, please follow it in all your interactions
variables, exposed ports, useful file locations and container parameters.
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. README.md
2. doc/versionhistory.tex and recompile manual.tex & snippets.tex
3. src/tikz-trackschematic.sty
2. doc/versionhistory.tex
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:

139
create-release.sh Executable file
View File

@ -0,0 +1,139 @@
#!/usr/bin/env sh
# Copyright (c) 2018 - 2022, Martin Scheidt (ISC license)
# Permission to use, copy, modify, and/or distribute this file for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
####
# This script produces a .zip-file in accordance to the requirements for CTAN.
# For more information see https://ctan.org/help/upload-pkg.
####
# Halt on error
set -e
## -- pass getopts
usage() { echo "Usage: create-release.sh [-v version]"; }
verbose=1
batch_mode=0
while getopts ":v" opt; do
case ${opt} in
v ) batch_mode=1
verbose=0
;;
\? ) usage
exit 1
;;
esac
done
if [ "`echo -n`" = "-n" ]; then
n=""
c="\c"
else
n="-n"
c=""
fi
if [ "$batch_mode" = 0 ]; then
echo $n "specify version ( e.g. v0.6 ): $c"
read VERSION
else
VERSION=$2
fi
## -- commands
check_readme() {
# check if $VERSION is present in README.md
status=0
grep -qs "Version ${VERSION:1}" README.md || status=1
if [ $status = 0 ]; then
if [ $verbose = 1 ]; then
echo "Version ${VERSION:1} is present in README.md."
fi
return 0
fi
echo "Version ${VERSION:1} not found in README.md."
echo "Be sure to edit README.md and specify current version!"
exit 1
}
check_versionhistory() {
# check if $VERSION is present in doc/versionhistory.tex
status=0
grep -qs "vhEntry{${VERSION:1}" doc/versionhistory.tex || status=1
if [ $status = 0 ]; then
if [ $verbose = 1 ]; then
echo "Version ${VERSION:1} is present in versionhistory.tex."
fi
return 0
fi
echo "Version ${VERSION:1} not found in versionhistory.tex."
echo "Be sure to edit versionhistory.tex and specify current version!"
exit 1
}
## -- creating the release
## check if $VERSION is present in README.md and versionhistory.tex
check_readme
check_versionhistory
## extract DATE from versionhistory.tex
LINE=$(grep "vhEntry{${VERSION:1}" doc/versionhistory.tex)
DATEISO=$(echo $LINE | egrep -o '\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])')
# DATE=$(echo $DATEISO | sed -e "s|-|\\\/|g") # with escape character for sed
# DATE=$(date "+%Y\/%m\/%d") # with escape character for sed
## update version number and delete line below in tikz-trackschematic.sty
sed -i '.backup' -e "s|VERSIONDATE|$DATEISO|g" src/tikz-trackschematic.sty
sed -i '' -e "/create-release/c\ " src/tikz-trackschematic.sty
## (OPTIONAL) recompile manual.tex, examples, symboly_table and snippets.tex`
## create zip-archive
# create temporary folder
TMP="tikz-trackschematic-$VERSION"
mkdir $TMP
# copy README and .sty-file
cp README.md $TMP/README.md
cp doc/tikz-trackschematic-documentation.sty $TMP/
# copy and rename documentation
cp doc/manual.pdf $TMP/tikz-trackschematic.pdf
cp doc/manual.tex $TMP/tikz-trackschematic.tex
cp doc/snippets.pdf $TMP/tikz-trackschematic-snippets.pdf
cp doc/snippets.tex $TMP/tikz-trackschematic-snippets.tex
cp doc/symbology_table.pdf $TMP/tikz-trackschematic-symbology-table.pdf
cp doc/symbology_table.tex $TMP/tikz-trackschematic-symbology-table.tex
mkdir $TMP/tikz-trackschematic-examples
mkdir $TMP/tikz-trackschematic-snippets
cp -R doc/examples/* $TMP/tikz-trackschematic-examples/
cp -R doc/snippets/* $TMP/tikz-trackschematic-snippets/
if [ $verbose = 1 ]; then
echo "copied documentation"
fi
# copy src-files
for SRC in src/*; do
cp $SRC $TMP
done
if [ $verbose = 1 ]; then
echo "copied src-files"
fi
# zip package
zip -r $TMP.zip $TMP/*
# cleanup
rm -rf $TMP/*
rmdir $TMP

View File

@ -1,42 +0,0 @@
#!/usr/bin/env sh
# Copyright (c) 2018 - 2022, Martin Scheidt (ISC license)
# Permission to use, copy, modify, and/or distribute this file for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
echo "specify version ( e.g. v0.6 ):"
read VERSION
# create temporary folder
mkdir tikz-trackschematic-$VERSION
# copy README and .sty-file
cp README.md tikz-trackschematic-$VERSION/README.md
cp doc/tikz-trackschematic-documentation.sty tikz-trackschematic-$VERSION/tikz-trackschematic-documentation.sty
# copy and rename documentation
cp doc/manual.pdf tikz-trackschematic-$VERSION/tikz-trackschematic.pdf
cp doc/manual.tex tikz-trackschematic-$VERSION/tikz-trackschematic.tex
cp doc/snippets.pdf tikz-trackschematic-$VERSION/tikz-trackschematic-snippets.pdf
cp doc/snippets.tex tikz-trackschematic-$VERSION/tikz-trackschematic-snippets.tex
mkdir tikz-trackschematic-$VERSION/tikz-trackschematic-examples
mkdir tikz-trackschematic-$VERSION/tikz-trackschematic-snippets
cp -R doc/examples/* tikz-trackschematic-$VERSION/tikz-trackschematic-examples
cp -R doc/snippets/* tikz-trackschematic-$VERSION/tikz-trackschematic-snippets
# copy src
cp src/tikz-trackschematic.sty tikz-trackschematic-$VERSION/tikz-trackschematic.sty
cp src/tikzlibrarytrackschematic.code.tex tikz-trackschematic-$VERSION/tikzlibrarytrackschematic.code.tex
cp src/tikzlibrarytrackschematic.constructions.code.tex tikz-trackschematic-$VERSION/tikzlibrarytrackschematic.constructions.code.tex
cp src/tikzlibrarytrackschematic.electrics.code.tex tikz-trackschematic-$VERSION/tikzlibrarytrackschematic.electrics.code.tex
cp src/tikzlibrarytrackschematic.measures.code.tex tikz-trackschematic-$VERSION/tikzlibrarytrackschematic.measures.code.tex
cp src/tikzlibrarytrackschematic.topology.code.tex tikz-trackschematic-$VERSION/tikzlibrarytrackschematic.topology.code.tex
cp src/tikzlibrarytrackschematic.trafficcontrol.code.tex tikz-trackschematic-$VERSION/tikzlibrarytrackschematic.trafficcontrol.code.tex
cp src/tikzlibrarytrackschematic.vehicles.code.tex tikz-trackschematic-$VERSION/tikzlibrarytrackschematic.vehicles.code.tex
cp src/tikzlibrarytrackschematic.symbology.code.tex tikz-trackschematic-$VERSION/tikzlibrarytrackschematic.symbology.code.tex
# zip package
zip -r tikz-trackschematic-$VERSION.zip tikz-trackschematic-$VERSION/*
#cleanup
rm -rf tikz-trackschematic-$VERSION/*
rmdir tikz-trackschematic-$VERSION

View File

@ -5,8 +5,8 @@
% Permission to use, copy, modify, and/or distribute this file for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
%
\NeedsTeXFormat{LaTeX2e}%
\ProvidesPackage{tikz-trackschematic}[2022/02/02 tikz-trackschematic]%
%
\ProvidesPackage{tikz-trackschematic}[VERSIONDATE tikz-trackschematic]%
% create-release.sh will remove this line and ^--VERSIONDATE will be replaced
%%%%%%%%%%%%%%%
% Package options
%%%%%%%%%%%%%%%