Skip to content

Commit 2875eda

Browse files
sadiq kassamalisadiq kassamali
authored andcommitted
2 parents 4137148 + 951e94f commit 2875eda

File tree

2 files changed

+40
-87
lines changed

2 files changed

+40
-87
lines changed

.github/workflows/python-app.yml

Lines changed: 15 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3-
41
name: VoiceAuth application
52

63
on:
@@ -10,90 +7,35 @@ on:
107
branches: [ "master" ]
118

129
permissions:
13-
id-token: write # This is required for requesting the JWT
14-
contents: read # This is required for actions/checkout
10+
id-token: write # Required for requesting the JWT
11+
contents: write # Required for actions/checkout
1512

1613
jobs:
1714
build:
1815
name: Build distribution 📦
1916
runs-on: ubuntu-latest
2017

2118
steps:
22-
- uses: actions/checkout@v4
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
2322
- name: Set up Python
2423
uses: actions/setup-python@v5
2524
with:
26-
python-version: "3.10.X"
27-
- name: Install pypa/build
25+
python-version: "3.10"
26+
27+
- name: Install dependencies
2828
run: |
29-
python -m pip install --upgrade -r requirements.txt
30-
pip install build
31-
- name: Build a binary wheel and a source tarball
29+
python -m pip install --upgrade pip wheel cx_Freeze build twine
30+
pip install -r requirements.txt build
31+
32+
- name: Build distribution packages
3233
run: |
33-
python -m pip install --upgrade -r requirements.txt
34-
python -m build --no-isolation
34+
pip install -r requirements.txt build
35+
python -m setup.py build --no-isolation
36+
3537
- name: Store the distribution packages
3638
uses: actions/upload-artifact@v4
3739
with:
3840
name: python-package-distributions
3941
path: dist/
40-
publish-to-pypi:
41-
name: >-
42-
Publish Python 🐍 distribution 📦 to PyPI
43-
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
44-
needs:
45-
- build
46-
runs-on: ubuntu-latest
47-
environment:
48-
name: pypi
49-
url: https://pypi.org/p/<package-name> # Replace <package-name> with your PyPI project name
50-
steps:
51-
- name: Download all the dists
52-
uses: actions/download-artifact@v4
53-
with:
54-
name: python-package-distributions
55-
path: dist/
56-
- name: Publish distribution 📦 to PyPI
57-
uses: pypa/gh-action-pypi-publish@release/v1
58-
github-release:
59-
name: >-
60-
Sign the Python 🐍 distribution 📦 with Sigstore
61-
and upload them to GitHub Release
62-
needs:
63-
- publish-to-pypi
64-
runs-on: ubuntu-latest
65-
66-
permissions:
67-
contents: write # IMPORTANT: mandatory for making GitHub Releases
68-
id-token: write # IMPORTANT: mandatory for sigstore
69-
70-
steps:
71-
- name: Download all the dists
72-
uses: actions/download-artifact@v4
73-
with:
74-
name: python-package-distributions
75-
path: dist/
76-
- name: Sign the dists with Sigstore
77-
uses: sigstore/[email protected]
78-
with:
79-
inputs: >-
80-
./dist/*.tar.gz
81-
./dist/*.whl
82-
- name: Create GitHub Release
83-
env:
84-
GITHUB_TOKEN: ${{ github.token }}
85-
run: >-
86-
gh release create
87-
'${{ github.ref_name }}'
88-
--repo '${{ github.repository }}'
89-
--notes ""
90-
- name: Upload artifact signatures to GitHub Release
91-
env:
92-
GITHUB_TOKEN: ${{ github.token }}
93-
# Upload to GitHub Release using the `gh` CLI.
94-
# `dist/` contains the built packages, and the
95-
# sigstore-produced signatures and certificates.
96-
run: >-
97-
gh release upload
98-
'${{ github.ref_name }}' dist/**
99-
--repo '${{ github.repository }}'
Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,48 @@
1-
name: Upload Python Package
1+
name: Voice Auth Upload Python Package
22

33
on:
44
release:
55
types: [published]
66

77
permissions:
8-
id-token: write # This is required for requesting the JWT
9-
contents: write # This is required for actions/checkout
8+
id-token: write # Required for OpenID authentication
9+
contents: write # Required for actions/checkout
1010

1111
jobs:
1212
deploy:
13-
1413
runs-on: ubuntu-latest
1514
environment:
1615
name: pypi
1716
url: https://pypi.org/p/VoiceAuth
17+
1818
steps:
19-
- uses: actions/checkout@v4
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
2022
- name: Set up Python
2123
uses: actions/setup-python@v3
2224
with:
23-
python-version: '3.10.X'
25+
python-version: "3.10"
26+
2427
- name: Install dependencies
2528
run: |
26-
python -m pip install --upgrade -r requirements.txt
27-
pip install build
28-
- name: Build package
29+
python -m pip install --upgrade pip wheel cx_Freeze build twine
30+
pip install -r requirements.txt build
31+
32+
- name: Build distribution packages
2933
run: |
30-
python -m pip install --upgrade -r requirements.txt
31-
python -m build --no-isolation
32-
- name: Publish package distributions to TestPyPI
34+
pip install -r requirements.txt build
35+
python -m setup.py build --no-isolation
36+
37+
38+
- name: Publish package to TestPyPI
3339
uses: pypa/gh-action-pypi-publish@release/v1
3440
with:
35-
repository-url: https://test.pypi.org/legacy/
36-
- name: Publish package distributions to PyPI
41+
repository-url: https://test.pypi.org/legacy/
42+
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
43+
44+
- name: Publish package to PyPI
45+
if: success()
3746
uses: pypa/gh-action-pypi-publish@release/v1
47+
with:
48+
password: ${{ secrets.PYPI_API_TOKEN }}

0 commit comments

Comments
 (0)