1+ name : build
2+ on :
3+ push :
4+ branches :
5+ - main
6+
7+ jobs :
8+ build_for_pypi :
9+ if : ${{ github.event.repository.name != 'ccxt-python-single-exchange' && (contains(github.event.head_commit.message, '[BUILD]') || contains(github.event.head_commit.message, '[PUBLISH]')) }}
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Checkout code
13+ uses : actions/checkout@v4
14+ with :
15+ ref : ${{ github.ref }}
16+ - name : Install npm
17+ uses : actions/setup-node@v4
18+ with :
19+ node-version : ' 22'
20+ - name : Install dependencies
21+ run : |
22+ cd build
23+ npm install
24+ npm install typescript
25+
26+ - name : Build single exchange
27+ run : |
28+ cd build
29+ # get repository name and it's first word before hyphen and pass that as argument
30+ EXCHANGE_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2 | cut -d'-' -f1)
31+ npm run build-single-exchange -- $EXCHANGE_NAME
32+
33+ - name : Commit and push back changes
34+ run : |
35+ git config --local user.email "[email protected] " 36+ git config --local user.name "GitHub Action"
37+ git add README.md
38+ git commit -m "pushback" || echo "No changes to commit"
39+ git push
40+
41+ - name : Set up Python
42+ if : contains(github.event.head_commit.message, '[PUBLISH]')
43+ uses : actions/setup-python@v4
44+ with :
45+ python-version : ' 3.x'
46+
47+ - name : Install dependencies
48+ if : contains(github.event.head_commit.message, '[PUBLISH]')
49+ run : |
50+ python -m pip install --upgrade pip
51+ pip install build twine
52+
53+ - name : PyPi packager
54+ if : contains(github.event.head_commit.message, '[PUBLISH]')
55+ env :
56+ PYPI_API_SECRET_SP : ${{ secrets.PYPI_API_SECRET_SP }}
57+ run : |
58+ cd build
59+ npm run pypi-packager
60+
61+ - name : PyPi upload
62+ if : contains(github.event.head_commit.message, '[PUBLISH]')
63+ run : |
64+ cd ./temp_pypi
65+ python -m twine upload dist/*
66+ env :
67+ TWINE_USERNAME : __token__
68+ TWINE_PASSWORD : ${{ secrets.PYPI_API_SECRET_SP }}
0 commit comments