From 092d016e2a0fb053f875056e7e7abdb8a44bed2f Mon Sep 17 00:00:00 2001 From: Mark G Date: Mon, 30 Oct 2023 11:13:08 -1000 Subject: [PATCH] Manual version tagging --- .github/workflows/main.yml | 29 +---------------------- .github/workflows/release.yml | 44 +++++++++++++++++++++++++++++++++++ README.md | 37 ++++++++++++----------------- 3 files changed, 60 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 46307a9..e8ede5b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Release +name: Main Test on: push: branches: @@ -58,30 +58,3 @@ jobs: GIT_BRANCH=main ./cc-test-reporter after-build \ -r ${{ secrets.CC_TEST_REPORTER_ID }} \ -t coverage.py - build: - outputs: - new_tag: ${{ steps.create_tag.outputs.new_tag }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@main - - name: Generate new tag (dry run) - uses: mathieudutour/github-tag-action@v6.1 - id: get_new_version - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - dry_run: true - - name: Build python dist - run: | - sed -i "s/version=\".*\"/version=\"${{ steps.get_new_version.outputs.new_version }}\"/" streamdal/__init__.py - sed -i "s/version=.*/version='${{ steps.get_new_version.outputs.new_version }}',/" setup.py - python3 setup.py sdist - - name: Publish package distributions to PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - packages-dir: dist - password: ${{ secrets.PYPI_API_TOKEN }} - - name: Create tag - uses: mathieudutour/github-tag-action@v6.1 - id: create_tag - with: - github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6edd7df --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,44 @@ +name: Release + +on: + push: + tags: + - 'v*.*.*' + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Get tag name + run: echo "TAG_NAME=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_ENV + - name: Get version + run: echo "TAG_VERSION=$(echo ${GITHUB_REF#refs/tags/v})" >> $GITHUB_ENV + - uses: actions/checkout@v2 + - name: Delete tag + uses: prompt/actions-delete-tag@v1 + - name: Delete tag local + run: git tag -d ${{ env.TAG_NAME }} + - name: Inject version into setup.py + run: | + sed -i "s/version=\".*\"/version=\"${{ env.TAG_VERSION }}\"/" streamdal/__init__.py + sed -i "s/version=.*/version='${{ env.TAG_VERSION }}',/" setup.py + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Bumped version in setup.py to ${{ env.TAG_VERSION }} + branch: main + tagging_message: ${{ env.TAG_NAME }} + push_options: '--force' + - name: Generate updated distribution + run: | + python3 setup.py sdist + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + packages-dir: dist + password: ${{ secrets.PYPI_API_TOKEN }} + - name: Create tag + uses: mathieudutour/github-tag-action@v6.1 + id: create_tag + with: + github_token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/README.md b/README.md index 59fc097..19b8032 100644 --- a/README.md +++ b/README.md @@ -28,31 +28,24 @@ python -m pip install streamdal import pprint from streamdal import (OPERATION_TYPE_CONSUMER, ProcessRequest, StreamdalClient, StreamdalConfig) - -def main(): - client = StreamdalClient( - cfg=StreamdalConfig( - service_name="order-ingest", - dry_run=True, - streamdal_url="streamdal-server.dev.svc.cluster.local:8082", - streamdal_token="1234", - ) +client = StreamdalClient( + cfg=StreamdalConfig( + service_name="order-ingest", + streamdal_url="streamdal-server.svc.cluster.local:8082", + streamdal_token="1234", ) - - res = client.process( - ProcessRequest( - operation_type=OPERATION_TYPE_CONSUMER, - operation_name="new-order-topic", - component_name="kafka", - data=b'{"object": {"field": true}}', - ) +) + +res = client.process( + ProcessRequest( + operation_type=OPERATION_TYPE_CONSUMER, + operation_name="new-order-topic", + component_name="kafka", + data=b'{"object": {"field": true}}', ) +) - pprint.pprint(res) - - -if __name__ == "__main__": - main() +pprint.pprint(res) ``` ### Metrics