diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml new file mode 100644 index 0000000..fbbe316 --- /dev/null +++ b/.github/workflows/python-publish.yml @@ -0,0 +1,52 @@ +name: Publish cryptlex.lexactivator package + +on: + workflow_dispatch: + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - run: git pull origin master --ff-only + + - name: Set up Python + uses: actions/setup-python@v5 + 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: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/* + + - name: Extract version and create tag + run: | + VERSION=$(sed -n 's/^[[:space:]]*version="\([^"]*\)".*/\1/p' setup.py) + + [ -n "$VERSION" ] || exit 1 + + git tag "$VERSION" 2>/dev/null || echo "Tag already exists" + git push origin "$VERSION" || true + + - name: Notify slack releases channel + uses: slackapi/slack-github-action@v2 + with: + webhook: ${{ secrets.SLACK_RELEASES_PROD_WEBHOOK_URL }} + webhook-type: webhook-trigger + payload: | + status: "${{ job.status }}" + environment: "PRODUCTION" + project: "LexActivator Python" diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml new file mode 100644 index 0000000..99cf175 --- /dev/null +++ b/.github/workflows/update-version.yml @@ -0,0 +1,44 @@ +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 + env: + LIBRARY_VERSION: ${{ github.event.inputs.libraryVersion }} + PACKAGE_VERSION: ${{ github.event.inputs.packageVersion }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Update Package Version + run: | + sed -i -E 's/^([[:space:]]*)version="[^"]*"/\1version="${{ env.PACKAGE_VERSION }}"/' setup.py + + - name: Update Library Version + run: | + sed -i -E 's/^([[:space:]]*lexactivator_libs_version[[:space:]]*=[[:space:]]*)"[^"]*"/\1"v${{ env.LIBRARY_VERSION }}"/' pre-publish.py + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + branch: ci/${{ env.PACKAGE_VERSION }} + title: "chore: bump package version to ${{ env.PACKAGE_VERSION }}" + commit-message: "chore(package version): updated version" + body: | + Automated package version bump. + base: master + add-paths: | + pre-publish.py + setup.py