|
name: build-single-exchange |
|
on: |
|
push: |
|
branches: |
|
- main |
|
|
|
jobs: |
|
build_for_pypi: |
|
if: ${{ github.event.repository.name != 'ccxt-python-single-exchange' && (contains(github.event.head_commit.message, '[BUILD]') || contains(github.event.head_commit.message, '[PUBLISH]')) }} |
|
runs-on: ubuntu-latest |
|
steps: |
|
- name: Checkout code |
|
uses: actions/checkout@v4 |
|
with: |
|
ref: ${{ github.ref }} |
|
- name: Install npm |
|
uses: actions/setup-node@v4 |
|
with: |
|
node-version: '22' |
|
- name: Install dependencies |
|
run: | |
|
cd build |
|
npm install |
|
npm install typescript |
|
|
|
- name: Build single exchange |
|
run: | |
|
cd build |
|
# get repository name and it's first word before hyphen and pass that as argument |
|
EXCHANGE_NAME=$(echo ${{ github.repository }} | cut -d'/' -f2 | cut -d'-' -f1) |
|
npm run build-single-exchange -- $EXCHANGE_NAME |
|
|
|
- name: Commit and push back changes |
|
run: | |
|
git config --local user.email "action@github.com" |
|
git config --local user.name "GitHub Action" |
|
git add README.md |
|
git add . |
|
git commit -m "pushback" || echo "No changes for commit" |
|
git push origin HEAD:main |
|
|
|
- name: Set up Python |
|
if: contains(github.event.head_commit.message, '[PUBLISH]') |
|
uses: actions/setup-python@v4 |
|
with: |
|
python-version: '3.x' |
|
|
|
- name: Install dependencies |
|
if: contains(github.event.head_commit.message, '[PUBLISH]') |
|
run: | |
|
python -m pip install --upgrade pip |
|
pip install build twine |
|
|
|
- name: PyPi package |
|
if: contains(github.event.head_commit.message, '[PUBLISH]') |
|
env: |
|
PYPI_API_SECRET_SP: ${{ secrets.PYPI_API_SECRET_SP }} |
|
run: | |
|
cd build |
|
npm run pypi-packager |
|
|
|
- name: PyPi upload |
|
if: contains(github.event.head_commit.message, '[PUBLISH]') |
|
run: | |
|
cd ./temp_pypi |
|
python -m twine upload dist/* |
|
env: |
|
TWINE_USERNAME: __token__ |
|
TWINE_PASSWORD: ${{ secrets.PYPI_API_SECRET_SP }} |