Skip to content

Commit

Permalink
Merge pull request #6 from cryptlex/ci/build-script
Browse files Browse the repository at this point in the history
refactor: isolated version update and build script
  • Loading branch information
azan-n authored Oct 19, 2023
2 parents cd50f3d + 334bd7e commit c3e918e
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 35 deletions.
40 changes: 5 additions & 35 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,58 +2,28 @@ name: Publish cryptlex.lexfloatclient package

on:
workflow_dispatch:
inputs:
libraryVersion:
description: 'Library Version'
required: true
default: ''
packageVersion:
description: 'Package Version'
required: true
default: ''

jobs:
update-version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Update Package Version
run: |
sed -i '/version=/!b;c \ \ \ \ version="${{ github.event.inputs.packageVersion }}",' setup.py
- name: Update Library Version
run: |
sed -i '/lexfloatclient_libs_version =/!b;clexfloatclient_libs_version = "v${{ github.event.inputs.libraryVersion }}"' pre-publish.py
- name: Commit, Tag and Push
run: |
git add pre-publish.py
git add setup.py
git config user.name github-actions
git config user.email [email protected]
git commit -m "updated version" | exit 0
git tag ${{ github.event.inputs.packageVersion }}
git push & git push --tags
deploy:
needs: update-version
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- run: git pull origin master --ff-only

- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Download Native Libs
run: python pre-publish.py

- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Update version

on:
workflow_dispatch:
inputs:
libraryVersion:
description: 'Library Version'
required: true
default: ''
packageVersion:
description: 'Package Version'
required: true
default: ''

jobs:
update-version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Update Package Version
run: |
sed -i '/version=/!b;c \ \ \ \ version="${{ github.event.inputs.packageVersion }}",' setup.py
- name: Update Library Version
run: |
sed -i '/lexfloatclient_libs_version =/!b;clexfloatclient_libs_version = "v${{ github.event.inputs.libraryVersion }}"' pre-publish.py
- name: Commit, Tag and Push
run: |
git add pre-publish.py
git add setup.py
git config user.name github-actions
git config user.email [email protected]
git commit -m "updated version" | exit 0
git tag ${{ github.event.inputs.packageVersion }}
git push & git push --tags

0 comments on commit c3e918e

Please sign in to comment.