-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (70 loc) · 2.41 KB
/
build.yml
File metadata and controls
80 lines (70 loc) · 2.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# Secret Variables required in GitHub secrets: TWINE_PASSWORD / TWINE_PASSWORD_TEST
name: build-python-package
on:
push:
branches: ["main"]
tags: ["v*"]
paths-ignore: ["*.md"]
pull_request:
branches: ["main"]
paths-ignore: ["*.md"]
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
TZ: Asia/Shanghai
jobs:
job-ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: "3.13"
- run: pip install ruff && ruff check ./src
job-semgrep:
runs-on: ubuntu-latest
container:
image: semgrep/semgrep:latest
continue-on-error: true
if: (github.actor != 'dependabot[bot]')
steps:
- uses: actions/checkout@v6
- run: |
semgrep ci --verbose \
--config p/ci \
--config p/security-audit \
--config p/python \
--config p/javascript \
--config p/react \
--config p/owasp-top-ten
build-pypi-package:
runs-on: ubuntu-latest
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
# sudo python setup.py install clean --all
- uses: actions/checkout@v6
- name: pip-install-test
run: |
sudo pip3 install -UI pip && sudo pip3 install -UI build setuptools wheel twine pyOpenSSL
cd src
sudo python3 -m build
pip3 install ./dist/*.tar.gz
aloha info
pip3 list | sort
- name: pypi-publish
env:
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_PASSWORD_TEST: ${{ secrets.TWINE_PASSWORD_TEST }}
run: |
env | sort -f && cd src && ls -alh
sudo python3 -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)"
sudo python3 -m build
ls -alh ./dist
if [ "${GITHUB_REPOSITORY}" = "LabNow-ai/aloha-python" ] && [ "${GITHUB_REF_NAME}" = "main" ] ; then
URL_REPOSITORY="https://upload.pypi.org/legacy/" ; P=${TWINE_PASSWORD} ;
else
URL_REPOSITORY="https://test.pypi.org/legacy/" ; P=${TWINE_PASSWORD_TEST} ;
fi
twine upload dist/* --verbose -u "__token__" -p "${P}" --repository-url "${URL_REPOSITORY}" ;