From 84b31eeb0eb69ccac47e8f4c51b259579524d1c3 Mon Sep 17 00:00:00 2001 From: Snigdhajyoti Ghosh Date: Thu, 16 Nov 2023 00:28:37 +0530 Subject: [PATCH] Publish 1.0 to PyPI --- .github/workflows/publish.yml | 34 ++++++++++++++++++++++++++++++++++ .github/workflows/tagging.yml | 18 ++++++++++++++---- aws_fusion/__init__.py | 2 +- 3 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..39df70d --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ +name: Publish to PyPI + +on: + push: + tags: + - '[0-9]+.[0-9]+' + +concurrency: publish + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + + - name: Build and publish to PyPI + run: | + python setup.py sdist bdist_wheel + python -m twine upload --repository testpypi dist/* + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} diff --git a/.github/workflows/tagging.yml b/.github/workflows/tagging.yml index c2477ed..1c25bac 100644 --- a/.github/workflows/tagging.yml +++ b/.github/workflows/tagging.yml @@ -1,6 +1,7 @@ -name: Tagging +name: Auto Tagging on: + workflow_dispatch: push: branches: - "main" @@ -31,9 +32,18 @@ jobs: - name: Get package information id: package_info run: | - echo "version=$(./setup.py --version)" >> "$GITHUB_OUTPUT" + current_version=$(./setup.py --version) + + tag_does_not_exist=true + if git rev-parse "refs/tags/$current_version" >/dev/null 2>&1; then + tag_does_not_exist=false + fi + + echo "version=${current_version}" >> "$GITHUB_OUTPUT" + echo "tag_does_not_exists=${tag_does_not_exist}" >> "$GITHUB_OUTPUT" - name: Add git tag + if: ${{ steps.package_info.outputs.tag_does_not_exists }} run: | - git tag ${{ steps.package_info.outputs.version }} -f - git push origin ${{ steps.package_info.outputs.version }} -f + git tag ${{ steps.package_info.outputs.version }} + git push origin ${{ steps.package_info.outputs.version }} diff --git a/aws_fusion/__init__.py b/aws_fusion/__init__.py index 5a6f84c..7e49527 100644 --- a/aws_fusion/__init__.py +++ b/aws_fusion/__init__.py @@ -1 +1 @@ -__version__ = '0.5' +__version__ = '1.0'