From 5dfcd09feb6b28d4fa2921ed21d545b319e46e95 Mon Sep 17 00:00:00 2001 From: Allison Suarez Miranda <22477579+allisonsuarez@users.noreply.github.com> Date: Thu, 28 Jan 2021 13:59:04 -0800 Subject: [PATCH] fix: changed release workflow completely (#882) * added PR creation to release action Signed-off-by: Allison Suarez Miranda * set new branch rather than master Signed-off-by: Allison Suarez Miranda * changed cron to 12:15pm Signed-off-by: Allison Suarez Miranda * chnaged release aciton branch and added manual run trigger Signed-off-by: Allison Suarez Miranda * eventually I'll get this right... Signed-off-by: Allison Suarez Miranda * another one Signed-off-by: Allison Suarez Miranda * one more branch change Signed-off-by: Allison Suarez Miranda * trying to get the branch there so it can be checked out Signed-off-by: Allison Suarez Miranda * added pypy credentials Signed-off-by: Allison Suarez Miranda * chaged to uses/with Signed-off-by: Allison Suarez Miranda * bumped version on setup.py file Signed-off-by: Allison Suarez Miranda * added pypi user and pass Signed-off-by: Allison Suarez Miranda * setting base branch to be master Signed-off-by: Allison Suarez Miranda * delete branch after pr closed Signed-off-by: Allison Suarez Miranda * trying a different more granular approach, pypi should be triggered once PR with new version is merged Signed-off-by: Allison Suarez Miranda * publishes new release Signed-off-by: Allison Suarez Miranda * fixed Signed-off-by: Allison Suarez Miranda * hoping this works, will add changelog next if it does Signed-off-by: Allison Suarez Miranda --- .github/workflows/monthly_release.yml | 27 +++++++++++------- .github/workflows/publish_release.yml | 41 +++++++++++++++++++++++++++ setup.cfg | 2 +- setup.py | 2 +- 4 files changed, 60 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/publish_release.yml diff --git a/.github/workflows/monthly_release.yml b/.github/workflows/monthly_release.yml index dffe90207..89916fcfd 100644 --- a/.github/workflows/monthly_release.yml +++ b/.github/workflows/monthly_release.yml @@ -12,22 +12,26 @@ on: jobs: release: runs-on: ubuntu-latest - + env: + BRANCH_NAME: new-release-${{ github.run_id }} steps: - uses: actions/setup-python@v2 with: python-version: 3.6 - - name: Checkout code + - name: Checkout master uses: actions/checkout@v2 with: fetch-depth: "0" - - name: Semantic Release - uses: relekang/python-semantic-release@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - pypi_username: __token__ - pypi_password: ${{ secrets.pypi_password }} - + - name: Create new branch + run: | + git checkout -b ${{ env.BRANCH_NAME }} + - name: Semantic release + run: | + pip install python-semantic-release + git config user.name github-actions + git config user.email github-actions@github.com + semantic-release version -D branch=${{ env.BRANCH_NAME }} + semantic-release changelog - name: Create release pull request uses: peter-evans/create-pull-request@v3 with: @@ -40,4 +44,7 @@ jobs: Auto-generated by [create-pull-request][1] [1]: https://github.com/peter-evans/create-pull-request - branch: new-release + branch: env.BRANCH_NAME + base: master + delete-branch: true + signoff: true diff --git a/.github/workflows/publish_release.yml b/.github/workflows/publish_release.yml new file mode 100644 index 000000000..a90830785 --- /dev/null +++ b/.github/workflows/publish_release.yml @@ -0,0 +1,41 @@ +name: Publish Monthly Release + +on: + push: + branches: + - master + paths: + # triggered when version is bumped + - "setup.py" +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup python 3.6 + uses: actions/setup-python@v1 + with: + python-version: 3.6 + - name: Get version + id: vers + run: | + pip install python-semantic-release + echo ::set-output name=version::$(semantic-release print-version --current) + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.vers.outputs.version }} + release_name: New features & Bug Fixes + - name: Add wheel dependency + run: pip install wheel + - name: Generate dist + run: python setup.py sdist bdist_wheel + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.pypi_password }} diff --git a/setup.cfg b/setup.cfg index 6a22febed..64cacb577 100644 --- a/setup.cfg +++ b/setup.cfg @@ -29,6 +29,6 @@ warn_no_return = True [semantic_release] version_variable = "./setup.py:__version__" -branch = new-release upload_to_pypi = true upload_to_release = true +commit_subject = "New release for {version}" diff --git a/setup.py b/setup.py index a2d6882f3..16c089511 100644 --- a/setup.py +++ b/setup.py @@ -37,7 +37,7 @@ def build_js() -> None: with open(requirements_path) as requirements_file: requirements = requirements_file.readlines() -__version__ = '3.2.0' +__version__ = '3.3.0' setup(