From e787ee3261ed3c9659876d36c82a95a4f774d6b0 Mon Sep 17 00:00:00 2001 From: msftcangoblowme Date: Thu, 29 Feb 2024 10:10:29 +0000 Subject: [PATCH] in release and kit get version first fetch-depth 0 build a release, igor.py build_next require the tagged package version. actions/checkout with fetch-depth 0 fetch branches and tags - chore: actions/checkout with fetch-depth 0 gets branches and tags - chore(release.yml): Publish package using pypa/gh-action-pypi-publish@release/v1 --- .github/workflows/kit.yml | 19 ++++++++++++++++--- .github/workflows/release.yml | 34 ++++++++++++++++++++++------------ CHANGES.rst | 8 ++++++++ docs/conf.py | 6 +++--- 4 files changed, 49 insertions(+), 18 deletions(-) diff --git a/.github/workflows/kit.yml b/.github/workflows/kit.yml index 4266212..dc128b7 100644 --- a/.github/workflows/kit.yml +++ b/.github/workflows/kit.yml @@ -13,7 +13,7 @@ # $ cp dist/* /tmp/pypi # $ python -m pip install piprepo # $ piprepo build /tmp/pypi -# $ python -m pip install -v coverage --index-url=file:///tmp/pypi/simple +# $ python -m pip install -v logging-strict --index-url=file:///tmp/pypi/simple # # Note that cibuildwheel recommends not shipping wheels for pre-release versions # of Python: https://cibuildwheel.readthedocs.io/en/stable/options/#prerelease-pythons @@ -147,6 +147,9 @@ jobs: - name: "Check out the repo" uses: actions/checkout@v4 + with: + # fetch all branches and tags instead of only fetching the ref/SHA that triggered the workflow + fetch-depth: 0 - name: "Install Python 3.9" uses: actions/setup-python@v5 @@ -186,10 +189,16 @@ jobs: steps: - name: "Check out the repo" uses: actions/checkout@v4 + with: + # fetch all branches and tags instead of only fetching the ref/SHA that triggered the workflow + fetch-depth: 0 - - name: Set output + # https://stackoverflow.com/questions/66349002/get-latest-tag-git-describe-tags-when-repo-is-cloned-with-depth-1 + # echo "tag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_OUTPUT + - name: Get latest tag id: vars - run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT + run: | + echo "tag=$(git describe --tags)" >> $GITHUB_OUTPUT - name: "Install Python 3.9" uses: actions/setup-python@v5 @@ -207,6 +216,7 @@ jobs: env: RELEASE_VERSION: ${{ steps.vars.outputs.tag }} run: | + echo "python igor.py build_next $RELEASE_VERSION" python igor.py build_next "$RELEASE_VERSION" - name: "List tarballs" @@ -226,6 +236,9 @@ jobs: steps: - name: "Check out the repo" uses: actions/checkout@v4 + with: + # fetch all branches and tags instead of only fetching the ref/SHA that triggered the workflow + fetch-depth: 0 - name: "Install PyPy" uses: actions/setup-python@v5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1ce96e0..c6c2b05 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,6 +8,11 @@ on: tags: - '*.*.*' + +defaults: + run: + shell: bash + env: PIP_DISABLE_PIP_VERSION_CHECK: 1 DEST_FOLDER: dist/ @@ -18,12 +23,16 @@ jobs: steps: - name: Checkout the repo uses: actions/checkout@v4 + with: + # fetch all branches and tags instead of only fetching the ref/SHA that triggered the workflow + fetch-depth: 0 # https://stackoverflow.com/questions/66349002/get-latest-tag-git-describe-tags-when-repo-is-cloned-with-depth-1 + # echo "tag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_OUTPUT - name: Get latest tag + id: vars run: | - git fetch -a - echo "tag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_OUTPUT + echo "tag=$(git describe --tags)" >> $GITHUB_OUTPUT - name: Install py39 uses: actions/setup-python@v5 @@ -31,22 +40,23 @@ jobs: python-version: 3.9 cache: pip cache-dependency-path: 'requirements/*.pip' + + - name: "Install tools" + run: | + python -m pip install --upgrade -r requirements/kit.pip + - name: build - shell: bash env: RELEASE_VERSION: ${{ steps.vars.outputs.tag }} run: | - python -m pip install --upgrade -r requirements/pip-tools.pip echo "python igor.py build_next $RELEASE_VERSION" python igor.py build_next "$RELEASE_VERSION" - - name: Release PyPI - shell: bash - env: - TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} - run: | - pip install --upgrade twine - twine upload ${{ env.DEST_FOLDER }}* + + - name: Publish package + uses: pypa/gh-action-pypi-publish@release/v1 + with: + password: ${{ secrets.PYPI_API_TOKEN }} + - name: Release GitHub uses: softprops/action-gh-release@v1 with: diff --git a/CHANGES.rst b/CHANGES.rst index a7eb26e..b744955 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -22,6 +22,14 @@ Changelog .. scriv-start-here +.. _changes_1-2-12: + +Version 1.2.12 — 2024-02-29 +--------------------------- + +- chore: actions/checkout with fetch-depth 0 gets branches and tags +- chore(release.yml): Publish package using pypa/gh-action-pypi-publish@release/v1 + .. _changes_1-2-11: Version 1.2.11 — 2024-02-28 diff --git a/docs/conf.py b/docs/conf.py index b256925..2f4761f 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -60,11 +60,11 @@ # @@@ editable copyright = "2023–2024, Dave Faulkmore" # The short X.Y.Z version. -version = "1.2.11" +version = "1.2.12" # The full version, including alpha/beta/rc tags. -release = "1.2.11" +release = "1.2.12" # The date of release, in "monthname day, year" format. -release_date = "February 28, 2024" +release_date = "February 29, 2024" # @@@ end # release = config.version