Skip to content

Commit 5787242

Browse files
committed
Add trusted publishing
1 parent a2875af commit 5787242

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

.github/workflows/release_python.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,38 @@ jobs:
77
build:
88
name: Build and publish package to PyPI
99
runs-on: ubuntu-latest
10+
environment: pypi
11+
permissions:
12+
# IMPORTANT: this permission is mandatory for Trusted Publishing
13+
id-token: write
1014
steps:
1115
- uses: actions/checkout@v4
1216

17+
- name: Set VERSION from tag
18+
run: |
19+
sed -i -E "s/^version = \".*\"/version = \"${GITHUB_REF#refs/*/v}\"/" pyproject.toml
20+
1321
- name: Set up Python
1422
uses: actions/setup-python@v5
1523
with:
1624
python-version: '3.12'
1725

18-
- name: Generate grammar
26+
- name: Set up dependencies
1927
run: |
2028
python -m pip install -r requirements.txt
29+
python -m pip install build twine
30+
31+
- name: Generate grammar
32+
run: |
2133
python setup_grammar.py python
2234
2335
- name: Build package
36+
working-directory: 'cratedb_sqlparse_py'
2437
run: |
25-
python -m pip install build twine
26-
cd cratedb_sqlparse_py
2738
python -m build
2839
twine check dist/{*.tar.gz,*.whl}
2940
3041
- name: Publish package to PyPI
31-
uses: pypa/gh-action-pypi-publish@release/v1
32-
with:
33-
packages-dir: cratedb_sqlparse_py/dist/
34-
user: __token__
35-
password: ${{ secrets.PYPI_API_TOKEN }}
42+
working-directory: 'cratedb_sqlparse_py'
43+
run: |
44+
python -m twine upload dist/*

0 commit comments

Comments
 (0)