WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Closed

chore #1293

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
60 changes: 60 additions & 0 deletions .github/actions/get-proto-version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
inputs:
python_version:
description: The Python version of the build toolchain to use.
required: true

outputs:
value:
description: The current version of mmm-proto-schema
value: ${{ steps.get_version.outputs.value }}

env:
PROTO_DIR: "proto"

runs:
using: composite
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Important: fetch all tags for comparison
fetch-tags: true

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.USE_PYTHON_VERSION }}

- name: Install semver
shell: bash
run: pip install semver

- name: Get version
id: get_version
shell: bash
run: |
VERSION=$(python -c """
import sys
import tomllib

try:
filepath = '${{ env.PROTO_DIR }}/pyproject.toml'
with open(filepath, 'rb') as f:
data = tomllib.load(f)

version = data.get('project', {}).get('version', '')
if version:
print(version)
else:
print(f'Error: Version not found in {filepath} under [project.version]', file=sys.stderr)
sys.exit(1)
except FileNotFoundError:
print(f'Error: File {filepath} not found', file=sys.stderr)
sys.exit(1)
""" )

if [ $? -ne 0 ]; then
echo "Failed to get version from ${{ env.PROTO_DIR}}/pyproject.toml"
exit 1
fi
echo "value=$VERSION" >> $GITHUB_OUTPUT
39 changes: 23 additions & 16 deletions .github/actions/version-check/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ inputs:
python_version:
description: The Python version of the build toolchain to use.
required: true
default: 3.11
semver_prefix:
description: The prefix of the package version.
required: true
current_version:
description: The current package version.
required: true

outputs:
new_version:
Expand All @@ -19,36 +24,38 @@ runs:
with:
fetch-depth: 0 # Important: fetch all tags for comparison
fetch-tags: true
- uses: ./.github/actions/install-meridian
with:
python_version: ${{ inputs.python_version }}
extras: ''
- shell: bash
run: pip install semver
- id: version_check
name: Check Version
shell: bash
# This relies on the git repository having "v{major}.{minor}.{patch}" named tags.
# This relies on the git repository having "{prefix}{major}.{minor}.{patch}" named tags.
run: |
CURRENT_VERSION=$(python3 -c "import meridian; print(meridian.__version__)")
CURRENT_VERSION=${{ inputs.current_version }}
PREVIOUS_TAG=$(git describe --tags --abbrev=0 --match '${{ inputs.semver_prefix }}*' || { echo "Error: No matching previous tag found." >&2; exit 1; })
PREVIOUS_VERSION=$(echo "$PREVIOUS_TAG" | sed 's/^${{ inputs.semver_prefix }}//')

echo "CURRENT_VERSION: $CURRENT_VERSION"
echo "PREVIOUS_TAG: $PREVIOUS_TAG"
echo "PREVIOUS_VERSION: $PREVIOUS_VERSION"

# Check if first version
if [ -z "$PREVIOUS_TAG" ]; then
echo "Warning: No matching previous tag found with pattern '${{ inputs.semver_prefix }}*'. Assuming first version."
echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
exit 0
fi

# Validate CURRENT_VERSION using semver check
if ! python3 -m semver check "$CURRENT_VERSION"; then
echo "Error: Invalid semantic version: $CURRENT_VERSION"
exit 1 # Fail fast
fi

PREVIOUS_TAG=$(git describe --tags --abbrev=0 --match 'v*' || { echo "Error: No matching previous tag found." >&2; exit 1; })
PREVIOUS_VERSION=$(echo "$PREVIOUS_TAG" | sed 's/^v//')

echo "CURRENT_VERSION: $CURRENT_VERSION"
echo "PREVIOUS_TAG: $PREVIOUS_TAG"
echo "PREVIOUS_VERSION: $PREVIOUS_VERSION"

if [[ $(python3 -m semver compare "$CURRENT_VERSION" "$PREVIOUS_VERSION") -eq 1 ]]; then
echo "New version detected: $CURRENT_VERSION"
NEW_VERSION=$CURRENT_VERSION
echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
else
echo "No version increment detected."
echo "new_version=" >> $GITHUB_OUTPUT
fi
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
33 changes: 32 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

env:
USE_PYTHON_VERSION: "3.11"
PROTO_DIR: "proto"

jobs:
# Build meridian "core" and "mmm-proto-schema" distributions.
Expand Down Expand Up @@ -36,10 +37,40 @@ jobs:
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- id: version_check

# Check meridian version
- uses: ./.github/actions/install-meridian
with:
python_version: ${{ inputs.python_version }}
extras: ''

- name: Get meridian version
id: get_meridian_version
shell: bash
run: |
VERSION=$(python -c "import meridian; print(meridian.__version__)")
echo "value=$VERSION" >> $GITHUB_OUTPUT

- name: Check meridian version
id: meridian_version_check
uses: ./.github/actions/version-check
with:
python_version: ${{ env.USE_PYTHON_VERSION }}
semver_prefix: v
current_version: ${{ steps.get_meridian_version.outputs.value}}

# Check mmm-proto-schema version
- name: Get mmm-proto-schema version
id: get_proto_version
uses: ./.github/actions/get-proto-version
with:
python_version: ${{ env.USE_PYTHON_VERSION }}
- name: Check mmm-proto-schema version
uses: ./.github/actions/version-check
with:
python_version: ${{ env.USE_PYTHON_VERSION }}
semver_prefix: proto-v
current_version: ${{ steps.get_proto_version.outputs.value}}

pytest:
runs-on: ubuntu-latest
Expand Down
76 changes: 10 additions & 66 deletions .github/workflows/proto-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,76 +48,20 @@ jobs:
outputs:
new_version: ${{ steps.compare_versions.outputs.new_version }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Important: fetch all tags for comparison
fetch-tags: true

- name: Set up Python
uses: actions/setup-python@v5
- uses: actions/checkout@v4
- name: Get mmm-proto-schema version
id: get_proto_version
uses: ./.github/actions/get-proto-version
with:
python-version: ${{ env.USE_PYTHON_VERSION }}

- name: Install semver
shell: bash
run: pip install semver

- name: Get version
id: get_version
shell: bash
run: |
VERSION=$(python -c """
import sys
import tomllib

try:
filepath = '${{ env.PROTO_DIR }}/pyproject.toml'
with open(filepath, 'rb') as f:
data = tomllib.load(f)

version = data.get('project', {}).get('version', '')
if version:
print(version)
else:
print(f'Error: Version not found in {filepath} under [project.version]', file=sys.stderr)
sys.exit(1)
except FileNotFoundError:
print(f'Error: File {filepath} not found', file=sys.stderr)
sys.exit(1)
""" )

if [ $? -ne 0 ]; then
echo "Failed to get version from ${{ env.PROTO_DIR}}/pyproject.toml"
exit 1
fi
echo "value=$VERSION" >> $GITHUB_OUTPUT
python_version: ${{ env.USE_PYTHON_VERSION }}

- name: Compare versions
id: compare_versions
run: |
CURRENT_VERSION="${{ steps.get_version.outputs.value }}"
PREVIOUS_TAG=$(git describe --tags --abbrev=0 --match 'proto-v*' || echo "")

if [ -z "$PREVIOUS_TAG" ]; then
echo "Warning: No matching previous tag found with pattern 'proto-v*'. Assuming first version."
echo "new_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
exit 0
fi

PREVIOUS_VERSION=$(echo "$PREVIOUS_TAG" | sed 's/^proto-v//')

echo "CURRENT_VERSION: $CURRENT_VERSION"
echo "PREVIOUS_TAG: $PREVIOUS_TAG"
echo "PREVIOUS_VERSION: $PREVIOUS_VERSION"

if [[ $(python3 -m semver compare "$CURRENT_VERSION" "$PREVIOUS_VERSION") -eq 1 ]]; then
echo "New version detected: $CURRENT_VERSION"
NEW_VERSION=$CURRENT_VERSION
else
echo "No version increment detected."
fi
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
uses: ./.github/actions/version-check
with:
python_version: ${{ env.USE_PYTHON_VERSION }}
semver_prefix: proto-v
current_version: ${{ steps.get_proto_version.outputs.value }}

create-proto-tag:
needs: check-proto-version
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,24 @@ jobs:
new_version: ${{ steps.version_check.outputs.new_version }}
steps:
- uses: actions/checkout@v4

- uses: ./.github/actions/install-meridian
with:
python_version: ${{ inputs.python_version }}
extras: ''

- id: get_version
shell: bash
run: |
VERSION=$(python -c "import meridian; print(meridian.__version__)")
echo "value=$VERSION" >> $GITHUB_OUTPUT

- id: version_check
uses: ./.github/actions/version-check
with:
python_version: ${{ env.USE_PYTHON_VERSION }}
semver_prefix: v
current_version: ${{ steps.get_version.outputs.value }}

create-tag:
needs: check-version
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ To release a new version (e.g. from `1.0.0` -> `2.0.0`):

## [Unreleased]

## [1.3.3] - 2025-12-04

* Update github actions

## [1.3.2] - 2025-11-26

* Fixed an out-of-bounds bug in EDA's VIF check.
Expand Down Expand Up @@ -419,4 +423,5 @@ To release a new version (e.g. from `1.0.0` -> `2.0.0`):
[1.3.0]: https://github.com/google/meridian/releases/tag/v1.3.0
[1.3.1]: https://github.com/google/meridian/releases/tag/v1.3.1
[1.3.2]: https://github.com/google/meridian/releases/tag/v1.3.2
[Unreleased]: https://github.com/google/meridian/compare/v1.3.2...HEAD
[1.3.3]: https://github.com/google/meridian/releases/tag/v1.3.3
[Unreleased]: https://github.com/google/meridian/compare/v1.3.3...HEAD
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ To cite this repository:
author = {Google Meridian Marketing Mix Modeling Team},
title = {Meridian: Marketing Mix Modeling},
url = {https://github.com/google/meridian},
version = {1.3.2},
version = {1.3.3},
year = {2025},
}
```
2 changes: 1 addition & 1 deletion meridian/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

"""Module for Meridian version."""

__version__ = "1.3.2"
__version__ = "1.3.3"
Loading