Reorganize documentation #25
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check version | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get previous dkpy version | |
id: latest_version | |
uses: Bruce17/ghaction-package-latest-version@v1 | |
with: | |
package: dkpy | |
language: python | |
# RegEx adapted from https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string | |
- name: Get pyproject.toml version | |
run: echo "pyproject_toml_version=`grep -Po "version = .\K(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?" pyproject.toml`" >> $GITHUB_ENV | |
- name: Get CITATION.cff version | |
run: echo "citation_cff_version=`grep -Po "version\:\ v\K(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?" CITATION.cff`" >> $GITHUB_ENV | |
- name: Get README.rst version | |
run: echo "readme_rst_version=`grep -Po "version\ =\ \{\{v\K(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?" README.rst`" >> $GITHUB_ENV | |
- name: Get doc/conf.py version | |
run: echo "doc_conf_py_version=`grep -Po "version = .\K(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?" doc/conf.py`" >> $GITHUB_ENV | |
- name: Get doc/conf.py release | |
run: echo "doc_conf_py_release=`grep -Po "release = .\K(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?" doc/conf.py`" >> $GITHUB_ENV | |
- name: Print versions | |
run: | | |
echo "pyproject.toml version is ${{ env.pyproject_toml_version }}" | |
echo "CITATION.cff version is ${{ env.citation_cff_version }}" | |
echo "README.rst version is ${{ env.readme_rst_version }}" | |
echo "doc/conf.py version is ${{ env.doc_conf_py_version }}" | |
echo "doc/conf.py release is ${{ env.doc_conf_py_release }}" | |
echo "Latest PyPi version is ${{ steps.latest_version.outputs.latestVersion }}" | |
- name: Fail if versions do not match | |
if: ${{ (env.citation_cff_version != env.pyproject_toml_version) || | |
(env.readme_rst_version != env.pyproject_toml_version) || | |
(env.doc_conf_py_version != env.pyproject_toml_version) || | |
(env.doc_conf_py_release != env.pyproject_toml_version) }} | |
run: | | |
echo "Version numbers in source are not consistent." | |
exit 1 | |
- name: Fail if any versions have not been updated | |
if: ${{ (env.pyproject_toml_version == steps.latest_version.outputs.latestVersion) || | |
(env.citation_cff_version == steps.latest_version.outputs.latestVersion) || | |
(env.readme_rst_version == steps.latest_version.outputs.latestVersion) || | |
(env.doc_conf_py_version == steps.latest_version.outputs.latestVersion) || | |
(env.doc_conf_py_release == steps.latest_version.outputs.latestVersion) }} | |
run: | | |
echo "Version numbers in source have not been updated." | |
exit 1 |