Skip to content

Commit 8d77075

Browse files
authored
Refactor GitHub Actions workflow for PyPI publishing
1 parent 145a5a1 commit 8d77075

File tree

1 file changed

+9
-58
lines changed

1 file changed

+9
-58
lines changed

.github/workflows/pypi.yml

Lines changed: 9 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,16 @@ on:
55
types: [released, prereleased]
66

77
jobs:
8-
build:
8+
publish:
99
runs-on: ubuntu-latest
1010

11+
permissions:
12+
id-token: write # required to push with trusted-pypi-token
13+
contents: wirte #required to push
14+
15+
env:
16+
BRANCH: ${{ github.event.release.target_commitish }}
17+
1118
steps:
1219
- uses: actions/checkout@v4
1320
with:
@@ -47,69 +54,13 @@ jobs:
4754

4855
- name: List contents of wheel
4956
run: python -m zipfile --list dist/servicex_analysis_utils-*.whl
50-
51-
- name: Upload an artifact of dist
52-
uses: actions/upload-artifact@v4
53-
with:
54-
name: dist-gha-artifact
55-
path: dist
56-
57-
publish:
58-
needs: build
59-
runs-on: ubuntu-latest
60-
61-
permissions:
62-
id-token: write # required to push with trusted-pypi-token
63-
64-
env:
65-
BRANCH: ${{ github.event.release.target_commitish }}
6657

67-
steps:
68-
- name: Set up Python 3.12
69-
uses: actions/setup-python@v5
70-
with:
71-
python-version: '3.12'
72-
73-
- name: Download artifact
74-
uses: actions/download-artifact@v4
75-
with:
76-
name: dist-gha-artifact
77-
path: dist
78-
7958
- name: Publish distribution
8059
uses: pypa/[email protected]
8160
with:
8261
print-hash: true
83-
84-
commit-version-bump:
85-
needs:
86-
- build
87-
- publish
88-
runs-on: ubuntu-latest
89-
permissions:
90-
contents: write # required to push with GITHUB_TOKEN
91-
92-
steps:
93-
- name: Checkout release target branch
94-
uses: actions/checkout@v4
95-
with:
96-
ref: $BRANCH
97-
98-
- name: Set up Python 3.12
99-
uses: actions/setup-python@v5
100-
with:
101-
python-version: '3.12'
102-
103-
- name: Set env
104-
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
105-
106-
- name: Update version to commit
107-
run: |
108-
sed -i 's/^version\s*=\s*".*"/version = "${{ env.RELEASE_VERSION }}"/' pyproject.toml
109-
sed -i '/__version__/ s/__version__\s*=.*/__version__ = "${{ env.RELEASE_VERSION }}"/' servicex_analysis_utils/__init__.py
110-
11162

112-
- name: Commit version change
63+
- name: Commit version change to branch
11364
run: |
11465
git config --local user.name "github-actions[bot]"
11566
git config --local user.email "github-actions[bot]@users.noreply.github.com"

0 commit comments

Comments
 (0)