feat/automations (#4) #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will generate a STABLE distribution and upload it to PyPI | |
name: Publish Stable Release | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- 'test/**' | |
- 'examples/**' | |
- '.github/**' | |
- '.gitignore' | |
- 'CHANGELOG.md' | |
- 'MANIFEST.in' | |
- 'scripts/**' | |
workflow_dispatch: | |
jobs: | |
build_and_publish: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: master | |
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository. | |
- name: Setup Python | |
uses: actions/setup-python@v1 | |
with: | |
python-version: 3.8 | |
- name: Install Build Tools | |
run: | | |
python -m pip install build wheel | |
- name: Remove Alpha tag | |
run: | | |
python scripts/remove_alpha.py --version-file $GITHUB_WORKSPACE/tutubo/version.py | |
- name: "Generate release changelog" | |
uses: heinrichreimer/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
maxIssues: 50 | |
id: changelog | |
- name: Commit to master | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Increment Version | |
branch: master | |
- name: Rebase dev on master | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email "[email protected]" | |
git checkout dev | |
git rebase origin/master | |
git push origin dev --force-with-lease | |
- name: version | |
run: echo "::set-output name=version::$(python setup.py --version)" | |
id: version | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: V${{ steps.version.outputs.version }} | |
release_name: Release ${{ steps.version.outputs.version }} | |
body: | | |
Changes in this Release | |
${{ steps.changelog.outputs.changelog }} | |
draft: false | |
prerelease: false | |
commitish: master | |
- name: Build Distribution Packages | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{secrets.PYPI_TOKEN}} |