diff --git a/.github/workflows/on-push-create-release.yml b/.github/workflows/on-push-create-release.yml new file mode 100644 index 00000000..cd3a29be --- /dev/null +++ b/.github/workflows/on-push-create-release.yml @@ -0,0 +1,65 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. +name: Create new release +on: + push: + branches: + - main + paths: + - 'azureiai/**' + - 'setup.py' + - 'Partner_Ingestion_SwaggerDocument.json' + workflow_dispatch: + +jobs: + CreateRelease: + runs-on: ubuntu-latest + steps: + - name: Bump version and push tag + id: tag_version + uses: mathieudutour/github-tag-action@v6.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + tag_prefix: "v" + dry_run: true + default_bump: false + + - name: Set Configurations + if: steps.tag_version.outputs.release_type + shell: bash + env: + OLD_VERSION: ${{ steps.tag_version.outputs.old_version }} + VERSION: ${{ steps.tag_version.outputs.new_version }} + run: sed -ri "s/$OLD_VERSION/$VERSION/" "setup.py" || exit 1 + + - uses: EndBug/add-and-commit@v9 + if: steps.tag_version.outputs.release_type + with: + message: Update Version to ${{ steps.tag_version.outputs.new_version }} + committer_name: GitHub Actions + committer_email: actions@github.com + add: setup.py + + - name: Setup Python + if: steps.tag_version.outputs.release_type + uses: actions/setup-python@v2.2.2 + with: + python-version: 3.7 + + - name: Install dependencies + if: steps.tag_version.outputs.release_type + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + python setup.py sdist bdist_wheel + + - uses: "marvinpinto/action-automatic-releases@latest" + if: steps.tag_version.outputs.release_type + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: ${{ steps.tag_version.outputs.new_tag }} + prerelease: false + files: | + LICENSE.md + *.tar.gz + *.whl