Skip to content

Commit 4e25c66

Browse files
committed
GHA: Wait for gitlint package to be available after publish (#434)
It takes a short time for packages to show up on PyPI after publishing. Wait for the gitlint package to show up before starting the post-release test run by trying to install the gitlint package, and retrying after a timeout until the package is available.
1 parent 0b6b1b3 commit 4e25c66

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

.github/workflows/publish-release.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,38 @@ jobs:
9696
HATCH_INDEX_AUTH: ${{ secrets.TEST_PYPI_GITLINT_PASSWORD }}
9797
if: inputs.pypi_target == 'test.pypi.org' && inputs.repo_release_ref == 'main'
9898

99-
test_release:
99+
# Wait for gitlint package to be available in PyPI for installation
100+
wait-for-package:
100101
needs:
101102
- publish
103+
runs-on: "ubuntu-latest"
104+
steps:
105+
- name: Install gitlint
106+
uses: nick-fields/[email protected]
107+
with:
108+
timeout_minutes: 1
109+
max_attempts: 10
110+
command: |
111+
python -m pip install gitlint==${{ needs.publish.outputs.gitlint_version }}
112+
if: inputs.pypi_target == 'pypi.org'
113+
114+
- name: Install gitlint (test.pypi.org)
115+
uses: nick-fields/[email protected]
116+
with:
117+
timeout_minutes: 1
118+
max_attempts: 10
119+
command: |
120+
pip install --no-cache -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple gitlint==${{ needs.publish.outputs.gitlint_version }}
121+
if: inputs.pypi_target == 'test.pypi.org'
122+
123+
- name: gitlint --version
124+
run: |
125+
gitlint --version
126+
[ "$(gitlint --version)" == "gitlint, version ${{ needs.publish.outputs.gitlint_version }}" ]
127+
128+
test-release:
129+
needs:
130+
- wait-for-package
102131
uses: ./.github/workflows/test-release.yml
103132
with:
104133
gitlint_version: ${{ needs.publish.outputs.gitlint_version }}

.github/workflows/test-release.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ on:
3535
default: "main"
3636

3737
jobs:
38-
checks:
38+
test-release:
3939
timeout-minutes: 10
4040
runs-on: "ubuntu-latest"
4141
strategy:
@@ -48,8 +48,6 @@ jobs:
4848
with:
4949
python-version: ${{ matrix.python-version }}
5050

51-
# Intentionally install hatch before gitlint, to buy us a few extra seconds in case the gitlint package was just
52-
# published and hasn't appeared on PyPI yet.
5351
- name: Install Hatch
5452
run: python -m pip install hatch==1.6.3
5553

0 commit comments

Comments
 (0)