diff --git a/.github/workflows/tagged-release.yml b/.github/workflows/tagged-release.yml new file mode 100644 index 0000000..be6b4cc --- /dev/null +++ b/.github/workflows/tagged-release.yml @@ -0,0 +1,51 @@ +name: "tagged-release" + +on: + push: + tags: + - "v*" + +jobs: + tagged-release: + name: "Auto-Release" + runs-on: "ubuntu-latest" + + steps: + - uses: actions/checkout@master + + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + + - name: Install the module + shell: bash + run: | + python -m pip install --upgrade pip + pip install wheel + pip install -e . + + - name: Get tag version + id: get_version + run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} + + - name: Set PyPi version as tag + run: python -m moepy.cicd set-current-package-version ${{ steps.get_version.outputs.VERSION }} + + - name: Create latest distribution + run: | + pip install -e . # reinstalling with new version number + python setup.py sdist bdist_wheel + - name: Publish package to PyPi + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + + - name: Update release on GitHub + uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + prerelease: false + files: | + LICENSE.txt