Merge pull request #1115 from PolicyEngine/fix/stage1-substep-status-… #481
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: Push to main | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - run: pip install ruff>=0.9.0 | |
| - run: ruff format --check . | |
| run-context: | |
| name: Run context | |
| runs-on: ubuntu-latest | |
| outputs: | |
| run_id: ${{ steps.run-context.outputs.run_id }} | |
| github_run_url: ${{ steps.run-context.outputs.github_run_url }} | |
| env: | |
| MODAL_ENVIRONMENT: main | |
| US_DATA_MODAL_APP_PREFIX: us-data | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.14" | |
| - name: Resolve run context | |
| id: run-context | |
| run: python .github/scripts/resolve_run_context.py | |
| data-release-version: | |
| name: Data release version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| package_version: ${{ steps.check-data-release-version.outputs.package_version }} | |
| finalized_release_version: ${{ steps.check-data-release-version.outputs.finalized_release_version }} | |
| release_version_relation: ${{ steps.check-data-release-version.outputs.release_version_relation }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14" | |
| - name: Require pyproject.toml to match finalized HF release base | |
| id: check-data-release-version | |
| env: | |
| HEAD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | |
| run: | | |
| mode=warn | |
| case "$HEAD_COMMIT_MESSAGE" in | |
| "Update publication candidate"*) mode=fail ;; | |
| esac | |
| python .github/scripts/check_data_release_version.py --mode "$mode" | |
| # ── Documentation ────────────────────────────────────────── | |
| docs: | |
| name: Documentation | |
| runs-on: ubuntu-latest | |
| if: | | |
| !startsWith(github.event.head_commit.message, 'Update publication candidate') && | |
| !startsWith(github.event.head_commit.message, 'Finalize package version') | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14" | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: "24" | |
| - uses: astral-sh/setup-uv@v8.1.0 | |
| - run: uv sync --dev | |
| - name: Generate pipeline documentation artifacts | |
| run: uv run python scripts/extract_pipeline_docs.py | |
| - name: Build documentation | |
| run: uv run make documentation | |
| env: | |
| BASE_URL: /policyengine-us-data | |
| - name: Deploy to GitHub Pages | |
| uses: JamesIves/github-pages-deploy-action@v4 | |
| with: | |
| branch: gh-pages | |
| folder: docs/_build/html | |
| clean: true | |
| # ── Publication candidate scope + changelog snapshot on ordinary pushes ── | |
| versioning: | |
| name: Versioning | |
| runs-on: ubuntu-latest | |
| needs: | |
| - run-context | |
| - data-release-version | |
| if: | | |
| !startsWith(github.event.head_commit.message, 'Update publication candidate') && | |
| !startsWith(github.event.head_commit.message, 'Finalize package version') && | |
| ( | |
| needs.data-release-version.outputs.release_version_relation == 'current' || | |
| needs.data-release-version.outputs.release_version_relation == 'ahead' || | |
| needs.data-release-version.outputs.release_version_relation == 'behind' | |
| ) | |
| outputs: | |
| version_sha: ${{ steps.version-commit.outputs.sha }} | |
| steps: | |
| - name: Generate GitHub App token | |
| id: app-token | |
| uses: actions/create-github-app-token@v3 | |
| with: | |
| app-id: ${{ secrets.APP_ID }} | |
| private-key: ${{ secrets.APP_PRIVATE_KEY }} | |
| - uses: actions/checkout@v6 | |
| with: | |
| token: ${{ steps.app-token.outputs.token }} | |
| fetch-depth: 0 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14" | |
| - uses: astral-sh/setup-uv@v8.1.0 | |
| - name: Sync finalized data release version | |
| if: needs.data-release-version.outputs.release_version_relation == 'behind' | |
| run: | | |
| python .github/scripts/sync_finalized_data_release_version.py \ | |
| --finalized-release-version "${{ needs.data-release-version.outputs.finalized_release_version }}" | |
| - name: Snapshot candidate changelog fragments | |
| env: | |
| US_DATA_RUN_ID: ${{ needs.run-context.outputs.run_id }} | |
| run: | | |
| python .github/bump_version.py | |
| - name: Generate pipeline documentation artifacts | |
| run: uv run --no-sync --with pyyaml python scripts/extract_pipeline_docs.py | |
| - name: Update lockfile | |
| run: uv lock | |
| - name: Update changelog | |
| uses: EndBug/add-and-commit@v10 | |
| with: | |
| add: "." | |
| message: Update publication candidate | |
| - name: Capture version commit | |
| id: version-commit | |
| run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | |
| # ── Full publication pipeline ─────────────────────────────── | |
| launch-pipeline: | |
| name: Launch publication pipeline | |
| runs-on: ubuntu-latest | |
| needs: | |
| - lint | |
| - run-context | |
| - data-release-version | |
| if: startsWith(github.event.head_commit.message, 'Update publication candidate') | |
| permissions: | |
| actions: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Dispatch pipeline workflow | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| US_DATA_RUN_ID: ${{ needs.run-context.outputs.run_id }} | |
| SOURCE_SHA: ${{ github.sha }} | |
| run: | | |
| export CANDIDATE_VERSION="$(python .github/scripts/fetch_publication_scope.py candidate_scope)" | |
| export BASE_RELEASE_VERSION="$(python .github/scripts/fetch_publication_scope.py base_release_version)" | |
| export RELEASE_BUMP="$(python .github/scripts/fetch_publication_scope.py release_bump)" | |
| bash .github/scripts/dispatch_publication_pipeline.sh |