wpilibsuite / sphinxext-opengraph

Sphinx extension to generate unique OpenGraph metadata
https://sphinxext-opengraph.readthedocs.io
Other
74 stars 27 forks source link

CI Failure - Releasing and Duplicate Runs #76

Closed TheTripleV closed 1 year ago

TheTripleV commented 1 year ago
  1. There are duplicate runs on push tag and create tag that should be eliminated
  2. Publishing to PyPi fails (https://github.com/wpilibsuite/sphinxext-opengraph/actions/runs/3353106081/jobs/5555742517#step:4:12) The built wheel is incorrectly versioned. The correct version is picked up but is replaced at some point with the branch name of "main".
auscompgeek commented 1 year ago

The built wheel is incorrectly versioned. The correct version is picked up but is replaced at some point with the branch name of "main".

I think the setup.py is overwriting the version in the sdist when building the wheel since it fails to run git describe in the isolated environment (which is a temporary directory).

hugovk commented 1 year ago

Yeah, I thought it was because https://github.com/actions/checkout does a shallow checkout by default, so we need to fetch all tags:

https://github.com/actions/checkout#Fetch-all-history-for-all-tags-and-branches

But I added that in PR #79 but it still fails.

We can see it gets the tag for the sdist but not the wheel:

Successfully built sphinxext-opengraph-0.7.0.tar.gz and sphinxext_opengraph-main-py3-none-any.whl

Printing the exception:

try:
    ret = subprocess.run(
        "git describe --tags --abbrev=0",
        capture_output=True,
        check=True,
        shell=True,
    )
    version = ret.stdout.decode("utf-8").strip()
except Exception as e:
    print(e)
    version = "main"

Gives:

Command 'git describe --tags --abbrev=0' returned non-zero exit status 128.
hugovk commented 1 year ago

For the first one, I think we want something like:

on:
  push:
    tags:
    - '*'

https://github.com/jazzband/django-taggit/blob/b24dfc401a44c247f44d82705f19d00d1f5d9ca7/.github/workflows/release.yml#L3-L6

Rather than:

on:
  create:
    tags:
      - '*'
TheTripleV commented 1 year ago

Closed in #79 and #80. https://pypi.org/project/sphinxext-opengraph/0.7.1/