Trigger documentation publishing alongside new releases #945
Workflow file for this run
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: Build, test, & publish | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - major-release | |
| release: | |
| types: | |
| - published | |
| permissions: read-all | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| CACHE_GLOBS: | | |
| **/pyproject.toml | |
| **/setup.py | |
| **/uv.lock | |
| steps: | |
| - uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d | |
| with: | |
| disable-sudo: true | |
| egress-policy: audit | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| - uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 | |
| with: | |
| python-version: 3.13 | |
| activate-environment: true | |
| cache-dependency-glob: ${{ env.CACHE_GLOBS }} | |
| - run: >- | |
| uv sync | |
| --upgrade | |
| --all-extras | |
| - run: >- | |
| uv build | |
| --sdist | |
| - uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f | |
| with: | |
| name: parsons-dist | |
| path: dist/ | |
| test: | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: | |
| - '3.10' | |
| - '3.11' | |
| - '3.12' | |
| - '3.13' | |
| os: | |
| - ubuntu-latest | |
| - windows-latest | |
| - macos-latest | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d | |
| with: | |
| disable-sudo: true | |
| egress-policy: audit | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c | |
| with: | |
| name: parsons-dist | |
| path: dist | |
| - name: extract requirements.txt for use in pip cache | |
| shell: bash | |
| run: | | |
| file=$(find ./dist -name 'parsons-*.tar.gz' | head -1) | |
| # Extract to a temp directory first | |
| mkdir -p temp_extract | |
| tar -xzf "$file" -C temp_extract | |
| # Find and move pyproject file to root | |
| find temp_extract -name 'pyproject.toml' -exec cp {} . \; 2>/dev/null || true | |
| # Clean up | |
| rm -rf temp_extract | |
| - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: install parsons from file | |
| shell: bash | |
| run: | | |
| file=$(find ./dist -name 'parsons-*.tar.gz' | head -1) | |
| pip install "$file" | |
| publish: | |
| if: github.repository_owner == 'move-coop' && github.event_name == 'release' && github.event.action == 'published' | |
| needs: test | |
| runs-on: ubuntu-latest | |
| environment: release | |
| permissions: | |
| id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
| steps: | |
| - uses: step-security/harden-runner@fe104658747b27e96e4f7e80cd0a94068e53901d | |
| with: | |
| disable-sudo: true | |
| egress-policy: audit | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c | |
| with: | |
| name: parsons-dist | |
| path: dist | |
| - uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e | |
| with: | |
| verify-metadata: true | |
| skip-existing: true | |
| packages-dir: dist | |
| verbose: true |