Skip to content

Commit 0259b9f

Browse files
authored
PYTHON-5047 Improve testing of publish workflows (#322)
1 parent 932bb73 commit 0259b9f

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

.github/workflows/release.yml

+18-6
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,19 @@ on:
1313
description: "Dry Run?"
1414
default: false
1515
type: boolean
16+
schedule:
17+
- cron: '30 5 * * *'
1618

1719
env:
1820
# Changes per repo
1921
PRODUCT_NAME: Motor
2022
# Changes per branch
2123
SILK_ASSET_GROUP: motor
2224
EVERGREEN_PROJECT: motor
25+
# Constant
26+
DRY_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.dry_run || 'true' }}
27+
FOLLOWING_VERSION: ${{ inputs.following_version || '' }}
28+
VERSION: ${{ inputs.version || '10.10.10.10' }}
2329

2430
defaults:
2531
run:
@@ -48,8 +54,8 @@ jobs:
4854
- uses: mongodb-labs/drivers-github-tools/python/pre-publish@v2
4955
id: pre-publish
5056
with:
51-
version: ${{ inputs.version }}
52-
dry_run: ${{ inputs.dry_run }}
57+
version: ${{ env.VERSION }}
58+
dry_run: ${{ env.DRY_RUN }}
5359

5460
build-dist:
5561
needs: [pre-publish]
@@ -76,8 +82,14 @@ jobs:
7682
with:
7783
name: all-dist-${{ github.run_id }}
7884
path: dist/
85+
- name: Publish package distributions to TestPyPI
86+
uses: pypa/gh-action-pypi-publish@release/v1
87+
with:
88+
repository-url: https://test.pypi.org/legacy/
89+
skip-existing: true
90+
attestations: ${{ env.DRY_RUN }}
7991
- name: Publish package distributions to PyPI
80-
if: startsWith(inputs.dry_run, 'false')
92+
if: startsWith(env.DRY_RUN, 'false')
8193
uses: pypa/gh-action-pypi-publish@release/v1
8294

8395
post-publish:
@@ -102,10 +114,10 @@ jobs:
102114
artifactory_username: ${{ vars.ARTIFACTORY_USERNAME }}
103115
- uses: mongodb-labs/drivers-github-tools/python/post-publish@v2
104116
with:
105-
version: ${{ inputs.version }}
106-
following_version: ${{ inputs.following_version }}
117+
version: ${{ env.VERSION }}
118+
following_version: ${{ env.FOLLOWING_VERSION }}
107119
product_name: ${{ env.PRODUCT_NAME }}
108120
silk_asset_group: ${{ env.SILK_ASSET_GROUP }}
109121
evergreen_project: ${{ env.EVERGREEN_PROJECT }}
110122
token: ${{ github.token }}
111-
dry_run: ${{ inputs.dry_run }}
123+
dry_run: ${{ env.DRY_RUN }}

0 commit comments

Comments
 (0)