Skip to content

Commit e08a71f

Browse files
Add publishing to release workflow (#63)
This PR modifies the `release.yml` workflow to publish the package to PyPI. It's difficult to test this without actually performing a release, so there may be changes necessary after everything else is prepared for the next release of the project. The 2 publishing steps are done in environments, so we can add a manual approval step to the production release environment. This will allow for manual verification steps against the package published to the test repository before the release is allowed continue. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
1 parent 3798f5c commit e08a71f

File tree

2 files changed

+71
-34
lines changed

2 files changed

+71
-34
lines changed

.github/workflows/release.yml

Lines changed: 71 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,43 @@ env:
1212
DEFAULT_BRANCH: version-0
1313

1414
jobs:
15-
update-changelog:
15+
wait-for-ci:
16+
name: Wait for CI/CD to pass
1617
runs-on: ubuntu-latest
1718
steps:
18-
- name: Checkout tag for build & publish
19-
uses: actions/checkout@v4
19+
- name: Wait for CI/CD workflow
20+
uses: lewagon/[email protected]
2021
with:
21-
token: ${{ secrets.GITHUB_TOKEN }}
22+
ref: ${{ github.event.release.tag_name }}
23+
check-regexp: 'Python v.*'
24+
repo-token: ${{ secrets.GITHUB_TOKEN }}
25+
wait-interval: 30
2226

23-
# TODO: Add build/publish steps here that use the tagged version
27+
build:
28+
name: Build distribution packages
29+
needs: wait-for-ci
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v5
33+
with:
34+
persist-credentials: false
35+
- name: Install uv
36+
uses: astral-sh/setup-uv@v6
37+
- name: Build
38+
run: uv build
39+
- name: Store the distribution packages
40+
uses: actions/upload-artifact@v4
41+
with:
42+
name: distributions
43+
path: dist/
2444

45+
update-changelog:
46+
needs:
47+
- build
48+
runs-on: ubuntu-latest
49+
steps:
2550
- name: Checkout default branch for changelog
26-
uses: actions/checkout@v4
51+
uses: actions/checkout@v5
2752
with:
2853
token: ${{ secrets.GITHUB_TOKEN }}
2954
ref: ${{ env.DEFAULT_BRANCH }}
@@ -34,3 +59,43 @@ jobs:
3459
file: CHANGELOG.md
3560
github_token: ${{ secrets.GITHUB_TOKEN }}
3661
pull_request: true
62+
63+
publish-to-testpypi:
64+
name: Publish to TestPyPI
65+
needs:
66+
- build
67+
runs-on: ubuntu-latest
68+
environment:
69+
name: testpypi
70+
url: https://test.pypi.org/p/aurora-dsql-django
71+
permissions:
72+
id-token: write
73+
steps:
74+
- name: Download all the dists
75+
uses: actions/download-artifact@v5
76+
with:
77+
name: distributions
78+
path: dist/
79+
- name: Publish distribution packages to TestPyPI
80+
uses: pypa/gh-action-pypi-publish@release/v1
81+
with:
82+
repository-url: https://test.pypi.org/legacy/
83+
84+
publish-to-pypi:
85+
name: Publish to PyPI
86+
needs:
87+
- publish-to-testpypi
88+
runs-on: ubuntu-latest
89+
environment:
90+
name: pypi
91+
url: https://pypi.org/p/aurora-dsql-django
92+
permissions:
93+
id-token: write
94+
steps:
95+
- name: Download all the dists
96+
uses: actions/download-artifact@v5
97+
with:
98+
name: distributions
99+
path: dist/
100+
- name: Publish distribution packages to PyPI
101+
uses: pypa/gh-action-pypi-publish@release/v1

buildspec.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)