Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 32 additions & 56 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ permissions:

jobs:
update-version-and-changelog:
# Run when PR has release labels (but not yet merged)
# Run only when a release label is added (not on every push)
if: |
github.event.action == 'labeled' &&
github.event.pull_request.merged == false && (
contains(github.event.pull_request.labels.*.name, 'release:major') ||
contains(github.event.pull_request.labels.*.name, 'release:minor') ||
contains(github.event.pull_request.labels.*.name, 'release:patch') ||
contains(github.event.pull_request.labels.*.name, 'release-dry-run')
contains(github.event.pull_request.labels.*.name, 'release:patch')
)
runs-on: ubuntu-latest

Expand All @@ -38,24 +38,16 @@ jobs:

- name: Install tools
run: |
pip install bump-my-version build
pip install bump-my-version build pandoc
sudo apt-get update
sudo apt-get install -y pandoc
cargo install git-cliff

- name: Set up Git user
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"

- name: Detect dry-run mode
id: dryrun
run: |
if [[ "${{ contains(github.event.pull_request.labels.*.name, 'release-dry-run') }}" == "true" ]]; then
echo "dryrun=true" >> $GITHUB_OUTPUT
else
echo "dryrun=false" >> $GITHUB_OUTPUT
fi

- name: Determine version bump type
id: bump
run: |
Expand All @@ -68,48 +60,52 @@ jobs:
fi

- name: Bump version
run: |
if [[ "${{ steps.dryrun.outputs.dryrun }}" == "true" ]]; then
echo "Dry run: version bump simulated"
else
bump-my-version bump ${{ steps.bump.outputs.type }}
fi
run: bump-my-version bump ${{ steps.bump.outputs.type }}
env:
BMV_ALLOW_DIRTY: "true"

- name: Extract version
id: version
run: |
VERSION=$(bump-my-version show current)
echo "Extracted version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Generate changelog
run: |
git cliff -o CHANGELOG.md
echo "Generated changelog for version ${{ steps.version.outputs.version }}"

- name: Update HISTORY.rst
run: |
# Convert CHANGELOG.md to rst and prepend to HISTORY.rst
if [ -f CHANGELOG.md ]; then
pandoc CHANGELOG.md -f markdown -t rst -o CHANGELOG.rst
# Prepend new changelog to HISTORY.rst
if [ -f HISTORY.rst ]; then
cat HISTORY.rst CHANGELOG.rst > HISTORY_temp.rst
mv HISTORY_temp.rst HISTORY.rst
echo "Updated HISTORY.rst with version ${{ steps.version.outputs.version }}"
else
mv CHANGELOG.rst HISTORY.rst
echo "Created HISTORY.rst"
fi
fi

- name: Commit and push changes to PR branch
if: steps.dryrun.outputs.dryrun == 'false'
run: |
git add .
git commit -m "chore: bump version to ${{ steps.version.outputs.version }} and update changelog [skip ci]" || echo "No changes to commit"
git push origin HEAD:${{ github.head_ref }}

- name: Comment on PR
if: steps.dryrun.outputs.dryrun == 'false'
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `✅ Version bumped to **${{ steps.version.outputs.version }}** and changelog updated. Please review the changes before merging.`
})

publish-after-merge:
# Run only after PR is merged
if: github.event.pull_request.merged == true
# Run only after PR is merged with release labels
if: |
github.event.pull_request.merged == true && (
contains(github.event.pull_request.labels.*.name, 'release:major') ||
contains(github.event.pull_request.labels.*.name, 'release:minor') ||
contains(github.event.pull_request.labels.*.name, 'release:patch')
)
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -144,34 +140,14 @@ jobs:
run: python -m build

- name: Publish to TestPyPI
if: steps.dryrun.outputs.dryrun == 'false'
id: test-pypi
uses: pypa/gh-action-pypi-publish@v1.13.0
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true

publish-pypi:
needs: publish-after-merge
if: needs.publish-after-merge.result == 'success'
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.13"

- name: Build package
run: |
pip install build
python -m build

- name: Publish to PyPI
if: steps.test-pypi.outcome == 'success'
uses: pypa/gh-action-pypi-publish@v1.13.0
with:
skip-existing: true
20 changes: 20 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Changelog All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.All notable changes to this project will be documented in this
file.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ MTH5 uses [h5py](https://www.h5py.org/) to interact with the HDF5 file, [xarray]
This project is in cooperation with the Incorporated Research Institutes of Seismology, the U.S. Geological Survey, and other collaborators. Facilities of the IRIS Consortium are supported by the National Science Foundation’s Seismological Facilities for the Advancement of Geoscience (SAGE) Award under Cooperative Support Agreement EAR-1851048. USGS is partially funded through the Community for Data Integration and IMAGe through the Minerals Resources Program.


* **Version**: 0.6.2
* **Version**: 0.6.3
* **Free software**: MIT license
* **Documentation**: https://mth5.readthedocs.io.
* **Examples**: Click the `Binder` badge above and Jupyter Notebook examples are in **docs/examples/notebooks**
Expand Down
6 changes: 3 additions & 3 deletions code.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
"licenses": [
{
"name": "MIT",
"URL": "https://code.usgs.gov/gmeg/mth5/-/raw/v0.6.2/LICENSE.md"
"URL": "https://code.usgs.gov/gmeg/mth5/-/raw/v0.6.3/LICENSE.md"
}
]
},
"homepageURL": "https://code.usgs.gov/gmeg/mth5",
"downloadURL": "https://code.usgs.gov/gmeg/mth5/-/archive/v0.6.2/mth5-v0.6.2.zip",
"disclaimerURL": "https://code.usgs.gov/gmeg/mth5/-/raw/v0.6.2/DISCLAIMER.md",
"downloadURL": "https://code.usgs.gov/gmeg/mth5/-/archive/v0.6.3/mth5-v0.6.3.zip",
"disclaimerURL": "https://code.usgs.gov/gmeg/mth5/-/raw/v0.6.3/DISCLAIMER.md",
"repositoryURL": "https://code.usgs.gov/gmeg/mth5.git",
"tags": [
"magnetotellurics",
Expand Down
2 changes: 1 addition & 1 deletion docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ MTH5 uses `h5py <https://www.h5py.org/>`_ to interact with the HDF5 file, `xarra

This project is in cooperation with the Incorporated Research Institutes of Seismology, the U.S. Geological Survey, and other collaborators. Facilities of the IRIS Consortium are supported by the National Science Foundation’s Seismological Facilities for the Advancement of Geoscience (SAGE) Award under Cooperative Support Agreement EAR-1851048. USGS is partially funded through the Community for Data Integration and IMAGe through the Minerals Resources Program.

* **Version**: 0.6.2
* **Version**: 0.6.3
* **Free software**: MIT license
* **Documentation**: `<https://mth5.readthedocs.io>`_.
* **Examples**: Click the `Binder` badge above and Jupyter Notebook examples are in **docs/examples/notebooks**
Expand Down
2 changes: 1 addition & 1 deletion mth5/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

__author__ = """Jared Peacock"""
__email__ = "jpeacock@usgs.gov"
__version__ = "0.6.2"
__version__ = "0.6.3"


# =============================================================================
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "mth5"
version = "0.6.2"
version = "0.6.3"
description = "Archivable and exchangeable format for magnetotelluric data"
authors = [
{name = "Jared Peacock", email = "jpeacock@usgs.gov"},
Expand Down Expand Up @@ -125,7 +125,7 @@ use_parentheses = true
ensure_newline_before_comments = true

[tool.bumpversion]
current_version = "0.6.2"
current_version = "0.6.3"
commit = true
tag = true

Expand Down
Loading