Add arviz_version to meridian_model. #20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Proto # For tagging and publishing releases. | |
| on: | |
| push: | |
| branches: | |
| - main # This entire workflow only runs on a push to the `main` branch (i.e. POST SUBMIT). | |
| paths: | |
| - 'proto/**' # Trigger only on changes to the proto directory. | |
| tags: | |
| - 'proto-v*' # Trigger only on pushed tags whose names start with 'proto-v'. | |
| workflow_dispatch: | |
| inputs: | |
| publish_proto_to_pypi: # Creates a boolean `github.event.inputs.publish_to_pypi` variable. | |
| description: 'Publish Proto to PyPI' | |
| required: false | |
| type: boolean | |
| default: false | |
| publish_proto_to_testpypi: | |
| description: 'Publish Proto to TestPyPI' | |
| required: false | |
| type: boolean | |
| default: false | |
| env: | |
| USE_PYTHON_VERSION: "3.11" | |
| PROTO_DIR: "proto" | |
| BUILD_ARTIFACT_NAME: "mmm-proto-package-distribution" | |
| PYPI_PACKAGE_NAME: "mmm-proto-schema" | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/build | |
| with: | |
| python_version: ${{ env.USE_PYTHON_VERSION }} | |
| working_directory: ${{ env.PROTO_DIR }} | |
| output_path: ${{env.PROTO_DIR}}/dist/ | |
| artifact_name: ${{ env.BUILD_ARTIFACT_NAME }} | |
| # Check if the current `version` semver has been incremented. If so, set a | |
| # `new_version` output. | |
| check-proto-version: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| outputs: | |
| new_version: ${{ steps.compare_versions.outputs.new_version }} | |
| steps: | |
| - 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: Compare versions | |
| id: compare_versions | |
| 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 | |
| # Only run if new_version was discovered, and do this only on the main branch. | |
| if: > | |
| github.ref == 'refs/heads/main' | |
| && needs.check-proto-version.outputs.new_version != '' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # Allow to create tags | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ./.github/actions/create-version-tag | |
| with: | |
| new_version: proto-v${{ needs.check-proto-version.outputs.new_version }} | |
| publish-proto-to-pypi: | |
| name: Publish Proto Python distribution to PyPI | |
| needs: | |
| - build | |
| - check-proto-version | |
| # Check if it's a tag push, or the `publish_proto_to_pypi` workflow is selected in a manual trigger. | |
| # or if a new version was discovered in a push to the `main` branch. | |
| if: > | |
| github.repository == 'google/meridian' && ( | |
| (github.ref_type == 'tag' && startsWith(github.ref, 'refs/tags/proto-v')) | |
| || (github.event_name == 'workflow_dispatch' | |
| && github.event.inputs.publish_proto_to_pypi == 'true') | |
| || (github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| && needs.check-proto-version.outputs.new_version != '') | |
| ) | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi-proto | |
| url: https://pypi.org/p/${{ env.PYPI_PACKAGE_NAME }} | |
| permissions: | |
| id-token: write # IMPORTANT: mandatory for trusted publishing | |
| steps: | |
| - name: Download all the dists | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ env.BUILD_ARTIFACT_NAME }} | |
| path: dist/ | |
| - name: Publish distribution to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| verbose: true | |
| publish-proto-to-testpypi: | |
| name: Publish Proto Python distribution to TestPyPI | |
| needs: build | |
| # Check if the `publish_proto_to_testpypi` workflow is selected in a manual trigger. | |
| if: > | |
| github.repository == 'google/meridian' && ( | |
| (github.event_name == 'workflow_dispatch' | |
| && github.event.inputs.publish_proto_to_testpypi == 'true') | |
| ) | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: testpypi-proto | |
| url: https://test.pypi.org/p/${{ env.PYPI_PACKAGE_NAME }} | |
| permissions: | |
| id-token: write # IMPORTANT: mandatory for trusted publishing | |
| steps: | |
| - name: Download all the dists | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ env.BUILD_ARTIFACT_NAME }} | |
| path: dist/ | |
| - name: Publish distribution to TestPyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: https://test.pypi.org/legacy/ | |
| verbose: true |