Skip to content

Commit

Permalink
allow specifying version to reset develop branch to
Browse files Browse the repository at this point in the history
  • Loading branch information
wpbonelli committed Jun 29, 2023
1 parent d4d104a commit 6907ba8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 15 deletions.
29 changes: 19 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ on:
required: false
default: true
type: boolean
environment_name:
description: Name of the GitHub environment to use for the release.
required: false
default: release
type: string
package_name:
# currently assumes module dir is in project root,
# and module name is the same as package name with
Expand All @@ -42,11 +47,11 @@ on:
required: false
default: '3.8'
type: string
reset_develop:
description: Reset the develop branch from the trunk.
reset_develop_version:
description: Version to reset the develop branch to.
required: false
default: true
type: boolean
default: ''
type: string
run_tests:
# currently assumes tests are in autotest/
description: Run tests after building binaries.
Expand Down Expand Up @@ -203,8 +208,8 @@ jobs:
contents: write
pull-requests: write
id-token: write # mandatory for trusted publishing
environment: # requires a 'pypi' environment in repo settings
name: pypi
environment:
name: ${{ inputs.environment_name }}
url: https://pypi.org/p/${{ inputs.package_name }}
steps:

Expand All @@ -220,6 +225,10 @@ jobs:
with:
python-version: ${{ inputs.python }}

# actions/download-artifact won't look at previous workflow runs but we need to in order to get changelog
- name: Download artifacts
uses: dawidd6/action-download-artifact@v2

- name: Install Python dependencies
run: |
pip install --upgrade pip
Expand All @@ -228,15 +237,16 @@ jobs:
- name: Check package
run: twine check --strict dist/*

# looks in dist/ dir by default
- name: Publish package
run: twine upload dist/*
uses: pypa/gh-action-pypi-publish@release/v1

reset_pr:
name: Draft reset PR
needs:
- make_dist
- release
if: github.event_name == 'release' && (inputs.reset_develop == '' || inputs.reset_develop == true)
if: github.event_name == 'release' && inputs.reset_develop_version != ''
runs-on: ubuntu-22.04
permissions:
contents: write
Expand Down Expand Up @@ -279,8 +289,7 @@ jobs:
# update version (add + to version.txt to indicate development status)
package=${{ inputs.package_name }}
module=${package//-/_}
version=$(python update_version.py -g)
python scripts/update_version.py -v "$version+"
python scripts/update_version.py -v "${{ inputs.reset_develop_version }}"
black -v $module/version.py
# commit and push reset branch
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release_dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ on:
required: false
default: '3.8'
type: string
reset_develop:
description: Reset the develop branch from the trunk.
reset_develop_version:
description: Version to reset the develop branch to.
required: false
default: true
type: boolean
default: ''
type: string
version:
description: Version number to use for release.
required: true
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
package_name: modflow-devtools
publish_package: false
python: ${{ needs.set_options.outputs.python }}
reset_develop: true
reset_develop_version: ${{ inputs.reset_develop_version }}
run_tests: true
trunk_branch: main
version: ${{ needs.set_options.outputs.version }}
Expand Down

0 comments on commit 6907ba8

Please sign in to comment.