Skip to content

Commit 5f5a500

Browse files
committed
test staging
1 parent 44c3879 commit 5f5a500

File tree

1 file changed

+46
-4
lines changed

1 file changed

+46
-4
lines changed

template/.github/workflows/publish.yaml.jinja

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ permissions:
1212
contents: write # needed for mutex
1313

1414
jobs:
15+
get-values:
16+
name: Get Values
17+
runs-on: {% endraw %}{{ gha_linux_runner }}{% raw %}
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@{% endraw %}{{ gha_checkout }}{% raw %}
21+
- name: Setup python
22+
uses: actions/setup-python@{% endraw %}{{ gha_setup_python }}{% raw %}
23+
with:
24+
python-version: {% endraw %}{{ python_version }}{% raw %}
25+
- name: Extract package version
26+
run: |
27+
VERSION=$(python3 ./github/workflows/git_tag.py)
28+
echo "package_version=$VERSION" >> $GITHUB_OUTPUT
29+
1530
lint:
1631
name: Pre-commit
1732
runs-on: {% endraw %}{{ gha_linux_runner }}{% raw %}
@@ -117,9 +132,6 @@ jobs:
117132
if-no-files-found: error
118133

119134

120-
121-
122-
123135
publish-to-staging:
124136
name: Publish Python distribution to Staging Package Registry
125137
needs: [ build ]
@@ -153,4 +165,34 @@ jobs:
153165
uses: pypa/gh-action-pypi-publish@v1.12.4
154166
with:
155167
attestations: false
156-
repository-url: https://test.pypi.org/legacy/{% endraw %}
168+
repository-url: https://test.pypi.org/legacy/
169+
170+
install-from-staging:
171+
name: Install package from staging registry
172+
needs: [ publish-to-staging, get-values ]
173+
runs-on: {% endraw %}{{ gha_linux_runner }}{% raw %}
174+
steps:
175+
- name: Setup python
176+
uses: actions/setup-python@{% endraw %}{{ gha_setup_python }}{% raw %}
177+
with:
178+
python-version: {% endraw %}{{ python_version }}{% raw %}
179+
- name: Install from staging registry
180+
run: pip install -i https://test.pypi.org/simple/ {% endraw %}{{ package_name | replace('_', '-') }}{% raw %}==${{ needs.get-values.outputs.package_version }}
181+
- name: Confirm library can be importde successfully
182+
run: python -c "import {% endraw %}{{ package_name }}{% raw %}"
183+
184+
create-tag:
185+
name: Create the git tag
186+
needs: [ install-from-staging ]
187+
runs-on: {% endraw %}{{ gha_linux_runner }}{% raw %}
188+
steps:
189+
- name: Checkout code
190+
uses: actions/checkout@{% endraw %}{{ gha_checkout }}{% raw %}
191+
- name: Setup python
192+
uses: actions/setup-python@{% endraw %}{{ gha_setup_python }}{% raw %}
193+
with:
194+
python-version: {% endraw %}{{ python_version }}{% raw %}
195+
- name: Confirm tag not already present
196+
run: python3 ./github/workflows/git_tag.py --confirm-tag-not-present
197+
- name: Create tag
198+
run: python3 ./github/workflows/git_tag.py --push-tag-to-remote{% endraw %}

0 commit comments

Comments
 (0)