From ae421af55e84d7a2868006e9793f84e27896c350 Mon Sep 17 00:00:00 2001 From: Andreas Maier Date: Wed, 9 Oct 2024 20:34:38 +0200 Subject: [PATCH] Make authors tolerates getting no authors from git Signed-off-by: Andreas Maier --- .github/workflows/publish.yml | 58 ++++++++++------------------------- Makefile | 7 +++-- 2 files changed, 21 insertions(+), 44 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 4491e8d..3fd87c9 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -156,73 +156,47 @@ jobs: # This is needed to get the authors from git. fetch-depth: 0 - - name: Debug - Display git authors - run: | - git shortlog --summary --email + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" - - name: Downgrade Git version + - name: Debug - Display git log count run: | - echo "Info for git package:" - sudo apt show git - echo "Policy for git package:" - sudo apt policy git - echo "git version:" - git --version - which git - # echo "Adding git-core repository:" - # sudo add-apt-repository -y ppa:git-core/ppa - echo "Updating package list:" - sudo apt-get update - echo "Downgrading git package:" - sudo apt-get install -y git=1:2.34.1 - echo "Info for git package:" - sudo apt show git - echo "git version:" - git --version - which git + git log --oneline | wc - name: Debug - Display git authors run: | git shortlog --summary --email - - name: Debug - Display git log - run: | - git log -1 --decorate + - name: Debug - Display git status run: | git status - - name: Debug - Display git describe - run: | - git describe --dirty --tags --long --match "*[0-9]*" - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" - name: Development setup run: | make develop - - name: Display Python packages - run: | - pip list - - #-------- Publishing of package - name: Debug - Display git status run: | git status - - name: Debug - Display git describe - run: | - git describe --dirty --tags --long --match "*[0-9]*" - - name: Debug - Display package version + + - name: Display Python packages run: | - python -m setuptools_scm + pip list + #-------- Publishing of package - name: Build the distribution run: | make build - name: Display the distribution directory run: | ls -l dist + + - name: Fail + run: | + false + - name: Publish distribution to PyPI if: startsWith(github.ref, 'refs/tags') uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/Makefile b/Makefile index 082d46f..ffc76c8 100644 --- a/Makefile +++ b/Makefile @@ -475,9 +475,12 @@ AUTHORS.md: _always echo "" >>AUTHORS.md.tmp echo "Sorted list of authors derived from git commit history:" >>AUTHORS.md.tmp echo '```' >>AUTHORS.md.tmp - git shortlog --summary --email | cut -f 2 | sort >>AUTHORS.md.tmp + sh -c "git shortlog --summary --email | cut -f 2 | sort >log.tmp" + sh -c "ls -l log.tmp" + sh -c "cat log.tmp >>AUTHORS.md.tmp" echo '```' >>AUTHORS.md.tmp - sh -c "if ! diff -q AUTHORS.md.tmp AUTHORS.md; then echo 'Updating AUTHORS.md:'; diff AUTHORS.md.tmp AUTHORS.md; mv AUTHORS.md.tmp AUTHORS.md; else echo 'AUTHORS.md is up to date'; rm AUTHORS.md.tmp; fi" + sh -c "if ! grep -q '[^[:space:]]' log.tmp; then echo 'Warning - git shortlog does not display any authors - leaving AUTHORS.md file unchanged'; else if ! diff -q AUTHORS.md.tmp AUTHORS.md; then echo 'Updating AUTHORS.md:'; diff AUTHORS.md.tmp AUTHORS.md; mv AUTHORS.md.tmp AUTHORS.md; else echo 'AUTHORS.md was already up to date'; fi; fi" + sh -c "rm -f log.tmp AUTHORS.md.tmp" .PHONY: clean clean: