Skip to content

Commit

Permalink
ci(release): remove reset step from release workflow (#138)
Browse files Browse the repository at this point in the history
* follow recent decisions in flopy, modflowapi, elsewhere
* ignore ci.yml on changes to release.yml or .gitignore
  • Loading branch information
wpbonelli authored Feb 8, 2024
1 parent 613ad01 commit c3ec63e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 67 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ on:
push:
paths-ignore:
- '**.md'
- '.github/workflows/release.yml'
- '.gitignore'
pull_request:
branches:
- main
- develop
paths-ignore:
- '**.md'
- '.github/workflows/release.yml'
- '.gitignore'
jobs:
lint:
name: Lint
Expand Down
67 changes: 1 addition & 66 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
body='
# Release '$ver'
The release can be approved by merging this pull request into `main`. This will trigger jobs to publish the release to PyPI and reset `develop` from `main`, incrementing the patch version number.
The release can be approved by merging this pull request into `main`. This will trigger a job to publish the release to PyPI.
## Changelog
Expand Down Expand Up @@ -200,68 +200,3 @@ jobs:

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

reset:
name: Draft reset PR
if: ${{ github.event_name == 'release' }}
runs-on: ubuntu-22.04
permissions:
contents: write
pull-requests: write
steps:

- name: Checkout main branch
uses: actions/checkout@v3
with:
ref: main

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
cache: 'pip'
cache-dependency-path: pyproject.toml

- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install .
pip install ".[lint, test]"
- name: Get release tag
uses: oprypin/find-latest-tag@v1
id: latest_tag
with:
repository: ${{ github.repository }}
releases-only: true

- name: Draft pull request
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
# create reset branch from main
reset_branch="post-release-${{ steps.latest_tag.outputs.tag }}-reset"
git switch -c $reset_branch
# increment minor version
major_version=$(echo "${{ steps.latest_tag.outputs.tag }}" | cut -d. -f1)
minor_version=$(echo "${{ steps.latest_tag.outputs.tag }}" | cut -d. -f2)
version="$major_version.$((minor_version + 1)).0.dev0"
python scripts/update_version.py -v "$version"
python scripts/lint.py
# commit and push reset branch
git config core.sharedRepository true
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "ci(release): update to development version $version"
git push -u origin $reset_branch
# create PR into develop
body='
# Reinitialize for development
Updates the `develop` branch from `main` following a successful release. Increments the patch version number.
'
gh pr create -B "develop" -H "$reset_branch" --title "Reinitialize develop branch" --draft --body "$body"
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,5 @@ app
# in case developer installs modflow executables in the project root
bin

**.DS_Store
**.DS_Store
data_backup

0 comments on commit c3ec63e

Please sign in to comment.