Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f5687ba

Browse files
committed
feat: make release flow reusable
Fixes #984
1 parent c8e60d7 commit f5687ba

File tree

2 files changed

+53
-38
lines changed

2 files changed

+53
-38
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
github_event_name:
7+
required: true
8+
type: string
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
id-token: write
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: astral-sh/setup-uv@v5
18+
19+
- name: Verify tag is documented
20+
if: inputs.github_event_name == 'release'
21+
run: |
22+
CURRENT_TAG=${GITHUB_REF#refs/tags/}
23+
CURRENT_VERSION=$(sed -n 's/version = "\(.*\)"/\1/p' pyproject.toml)
24+
if [ "${CURRENT_VERSION}" != "${CURRENT_TAG}" ]; then
25+
echo "========================================================================"
26+
echo "Error: tag '${CURRENT_TAG}' and version '${CURRENT_VERSION}' don't match"
27+
echo "========================================================================"
28+
exit 1;
29+
fi
30+
31+
- run: uv build
32+
33+
- name: Verify wheel install
34+
run: uv venv venv-install-whl . venv-install-whl/bin/activate uv pip install dist/*.whl
35+
36+
- name: Verify source install
37+
run: uv venv venv-install-tar . venv-install-tar/bin/activate uv pip install dist/*.tar.gz
38+
39+
- uses: actions/upload-artifact@v4
40+
if: inputs.github_event_name == 'release'
41+
with:
42+
name: dist
43+
path: |
44+
dist/*.tar.gz
45+
dist/*.whl
46+
47+
- run: uvx twine check dist/*
48+
49+
- if: inputs.github_event_name == 'release'
50+
run: uv publish --trusted-publishing always

.github/workflows/release.yml

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,8 @@ on:
88

99
jobs:
1010
release:
11-
runs-on: ubuntu-latest
11+
uses: ./.github/workflows/release-shared.yml
12+
with:
13+
github_event_name: ${{ github.event_name }}
1214
permissions:
1315
id-token: write
14-
steps:
15-
- uses: actions/checkout@v4
16-
- uses: astral-sh/setup-uv@v5
17-
18-
- name: Verify tag is documented
19-
if: github.event_name == 'release'
20-
run: |
21-
CURRENT_TAG=${GITHUB_REF#refs/tags/}
22-
CURRENT_VERSION=$(sed -n 's/version = "\(.*\)"/\1/p' pyproject.toml)
23-
if [ "${CURRENT_VERSION}" != "${CURRENT_TAG}" ]; then
24-
echo "========================================================================"
25-
echo "Error: tag '${CURRENT_TAG}' and version '${CURRENT_VERSION}' don't match"
26-
echo "========================================================================"
27-
exit 1;
28-
fi
29-
30-
- name: Build dist
31-
run: uv build
32-
33-
- name: Archive dist
34-
if: github.event_name == 'release'
35-
uses: actions/upload-artifact@v4
36-
with:
37-
name: dist
38-
path: |
39-
dist/*.tar.gz
40-
dist/*.whl
41-
42-
- name: Verify long description rendering
43-
run: uvx twine check dist/*
44-
45-
- name: Publish
46-
env:
47-
# TODO: remove once trusted publishing is configured
48-
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
49-
if: github.event_name == 'release' && github.repository == 'python-social-auth/social-core'
50-
run: uv publish

0 commit comments

Comments
 (0)