diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..b7b11da --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ +name: Publish to PyPI + +on: + push: + tags: + - '**' + +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..5e5dd0c 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,19 @@ jobs: - name: Get package information id: package_info run: | - echo "version=$(./setup.py --version)" >> "$GITHUB_OUTPUT" + current_version=$(./setup.py --version) + + tag_exist=false + if git rev-parse "refs/tags/$current_version" >/dev/null 2>&1; then + echo "::warning title=Tag already exists::${current_version}" + tag_exist=true + fi + + echo "version=${current_version}" >> "$GITHUB_OUTPUT" + echo "tag_exist=${tag_exist}" >> "$GITHUB_OUTPUT" - name: Add git tag + if: ${{ steps.package_info.outputs.tag_exist == 'false' }} 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'