gci: Checkout entire history in PyPI build to ensure tags are there

setuptools_scm requires the ability to look up the latest tag.
This commit is contained in:
Christian Decker
2021-09-23 14:06:47 +02:00
parent c4af904342
commit 808f582638

View File

@@ -3,7 +3,7 @@ name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
on: push on: push
jobs: jobs:
deploy: deploy:
name: Build and publish ${{ matrix.package }} 🐍 name: Build and publish ${{ matrix.package }} 🐍
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
strategy: strategy:
fail-fast: true fail-fast: true
@@ -23,30 +23,38 @@ jobs:
WORKDIR: contrib/pyln-spec/bolt4/ WORKDIR: contrib/pyln-spec/bolt4/
- PACKAGE: pyn-bolt7 - PACKAGE: pyn-bolt7
WORKDIR: contrib/pyln-spec/bolt7/ WORKDIR: contrib/pyln-spec/bolt7/
steps: steps:
- uses: actions/checkout@master - uses: actions/checkout@master
- name: Set up Python 3.7 with:
uses: actions/setup-python@v1 # Need to fetch entire history in order to locate the version tag
with: fetch-depth: 0
python-version: 3.7
- name: Install pypa/build - name: Set up Python 3.7
run: >- uses: actions/setup-python@v1
with:
python-version: 3.7
- name: Install pypa/build
run: >-
python -m pip install build --user python -m pip install build --user
- name: Build a binary wheel and a source tarball - name: Build a binary wheel and a source tarball
env: env:
WORKDIR: ${{ matrix.WORKDIR }} WORKDIR: ${{ matrix.WORKDIR }}
run: >- run: >-
cd ${{ env.WORKDIR}} && cd ${{ env.WORKDIR}} &&
python -m build --sdist --wheel --outdir dist/ . python -m build --sdist --wheel --outdir dist/ .
- name: Publish distribution 📦 to Test PyPI
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master uses: pypa/gh-action-pypi-publish@master
env: env:
WORKDIR: ${{ matrix.WORKDIR }} WORKDIR: ${{ matrix.WORKDIR }}
with: with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }} password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/ repository_url: https://test.pypi.org/legacy/
packages_dir: "${{ env.WORKDIR}}/dist" packages_dir: "${{ env.WORKDIR}}/dist"
skip_existing: true skip_existing: true
- name: Publish distribution 📦 to PyPI - name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags') if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master uses: pypa/gh-action-pypi-publish@master