Skip to content

Commit fdb4e4b

Browse files
committed
Update github actions to upload to pypi
1 parent 4748716 commit fdb4e4b

3 files changed

Lines changed: 83 additions & 16 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 79 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,93 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
build-and-publish:
10+
build:
1111
runs-on: ubuntu-latest
1212

1313
steps:
1414
- name: Checkout sources
15-
uses: actions/checkout@v2
15+
uses: actions/checkout@v4
1616

1717
- name: Setup Python
1818
uses: actions/setup-python@v2
1919
with:
20-
python-version: "3.10"
20+
python-version: "3.x"
2121

22-
- name: Install poetry and dependencies
23-
run: |
24-
python -m pip install --upgrade pip
25-
python -m pip install poetry
22+
- name: Install pypa/build
23+
run: >-
24+
python3 -m
25+
pip install
26+
build
27+
--user
28+
- name: Build a binary wheel and a source tarball
29+
run: python3 -m build
30+
- name: Store the distribution packages
31+
uses: actions/upload-artifact@v3
32+
with:
33+
name: python-package-distributions
34+
path: dist/
35+
36+
publish-to-pypi:
37+
name: >-
38+
Publish Python distribution to PyPI
39+
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
40+
needs:
41+
- build
42+
runs-on: ubuntu-latest
43+
environment:
44+
name: pypi
45+
url: https://pypi.org/p/compmec-section
46+
permissions:
47+
id-token: write # IMPORTANT: mandatory for trusted publishing
48+
steps:
49+
- name: Download all the dists
50+
uses: actions/download-artifact@v3
51+
with:
52+
name: python-package-distributions
53+
path: dist/
54+
- name: Publish distribution 📦 to PyPI
55+
uses: pypa/gh-action-pypi-publish@release/v1
56+
57+
github-release:
58+
name: >-
59+
Sign the Python 🐍 distribution 📦 with Sigstore
60+
and upload them to GitHub Release
61+
needs:
62+
- publish-to-pypi
63+
runs-on: ubuntu-latest
2664

27-
- name: Configure poetry
28-
env:
29-
pypi_token: ${{ secrets.PyPI_TOKEN }}
30-
run: poetry config pypi-token.pypi $pypi_token
65+
permissions:
66+
contents: write # IMPORTANT: mandatory for making GitHub Releases
67+
id-token: write # IMPORTANT: mandatory for sigstore
3168

32-
- name: Build and publish
33-
run: poetry publish --build
69+
steps:
70+
- name: Download all the dists
71+
uses: actions/download-artifact@v3
72+
with:
73+
name: python-package-distributions
74+
path: dist/
75+
- name: Sign the dists with Sigstore
76+
uses: sigstore/gh-action-sigstore-python@v1.2.3
77+
with:
78+
inputs: >-
79+
./dist/*.tar.gz
80+
./dist/*.whl
81+
- name: Create GitHub Release
82+
env:
83+
GITHUB_TOKEN: ${{ github.token }}
84+
run: >-
85+
gh release create
86+
'${{ github.ref_name }}'
87+
--repo '${{ github.repository }}'
88+
--notes ""
89+
- name: Upload artifact signatures to GitHub Release
90+
env:
91+
GITHUB_TOKEN: ${{ github.token }}
92+
# Upload to GitHub Release using the `gh` CLI.
93+
# `dist/` contains the built packages, and the
94+
# sigstore-produced signatures and certificates.
95+
run: >-
96+
gh release upload
97+
'${{ github.ref_name }}' dist/**
98+
--repo '${{ github.repository }}'
99+

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,4 @@ dmypy.json
124124
.pyre/
125125

126126
docs/source/sphinx_gallery_examples/index.rst
127-
console.py
127+
console/*

src/compmec/section/bem2d.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,10 @@ def solve(self):
450450
vector = np.pad(vector, (0, 1), constant_values=0)
451451
warpvals = np.linalg.solve(matrix, vector)[:-1]
452452
# Now compute torsion center
453-
amatrix, bvector = TorsionConstraintVector(self.__all_vertices[0])
453+
vertices = self.__all_vertices[0]
454+
amatrix, bvector = TorsionConstraintVector(vertices)
454455
bvector += np.einsum("ij,j->i", amatrix, warpvals)
455-
cmatrix = AreaProperties(self.__all_vertices[0])
456+
cmatrix = AreaProperties(vertices)
456457
result = np.linalg.solve(cmatrix, bvector)
457458
c0, x0, y0 = result[0], -result[2], result[1]
458459
self.__center = (x0, y0)

0 commit comments

Comments
 (0)