Skip to content

Commit 01afd5c

Browse files
authored
Merge pull request #49 from ethanholz/ci/release
ci: add a formal release workflow
2 parents 8d41ec3 + e754db9 commit 01afd5c

1 file changed

Lines changed: 23 additions & 7 deletions

File tree

.github/workflows/release.yaml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,30 @@ jobs:
3030
with:
3131
name: gha-runner-dists
3232
path: dist/
33-
publish-to-test-pypi:
34-
name: Publish distribution
33+
- name: Determine release type
34+
id: release-type
35+
run: |
36+
if [[ "${{ github.event.release.prerelease }}" == "true" ]]; then
37+
echo "repository_url=https://test.pypi.org/legacy/" | tee -a "$GITHUB_OUTPUT"
38+
echo "verbose=true" | tee -a "$GITHUB_OUTPUT"
39+
echo "environment_name=testpypi" | tee -a "$GITHUB_OUTPUT"
40+
echo "environment_url=https://test.pypi.org/p/gha_runner"
41+
else
42+
echo "repository_url=https://upload.pypi.org/legacy/" | tee -a "$GITHUB_OUTPUT"
43+
echo "verbose=false" | tee -a "$GITHUB_OUTPUT"
44+
echo "environment_name=pypi" | tee -a "$GITHUB_OUTPUT"
45+
echo "environment_url=https://pypi.org/p/gha_runner" | tee -a "$GITHUB_OUTPUT"
46+
fi
47+
48+
49+
publish:
50+
name: Publish distribution to ${{ needs.build.outputs.environment_name }}
3551
needs:
3652
- build
3753
runs-on: ubuntu-latest
3854
environment:
39-
name: testpypi
40-
url: https://test.pypi.org/p/gha_runner
55+
name: ${{ needs.build.outputs.environment_name }}
56+
url: ${{ needs.build.outputs.enviuronment_url }}
4157
permissions:
4258
id-token: write
4359
steps:
@@ -46,8 +62,8 @@ jobs:
4662
with:
4763
name: gha-runner-dists
4864
path: dist/
49-
- name: Publish to TestPyPI
65+
- name: Publish to PyPI
5066
uses: pypa/gh-action-pypi-publish@release/v1
5167
with:
52-
repository-url: https://test.pypi.org/legacy/
53-
verbose: true
68+
repository-url: ${{ needs.build.outputs.repository_url }}
69+
verbose: ${{ needs.build.outputs.verbose }}

0 commit comments

Comments
 (0)