Skip to content

Commit

Permalink
in release and kit get version first fetch-depth 0
Browse files Browse the repository at this point in the history
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
  • Loading branch information
msftcangoblowm committed Feb 29, 2024
1 parent 6e582e6 commit e787ee3
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 18 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/kit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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"
Expand All @@ -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
Expand Down
34 changes: 22 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
tags:
- '*.*.*'


defaults:
run:
shell: bash

env:
PIP_DISABLE_PIP_VERSION_CHECK: 1
DEST_FOLDER: dist/
Expand All @@ -18,35 +23,40 @@ 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
with:
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:
Expand Down
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e787ee3

Please sign in to comment.