update pacakge name from py-d2 to d2-python (#4) #3
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: Run Project | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| workflow_dispatch: | |
| inputs: | |
| script_name: | |
| description: 'uv script name' | |
| required: true | |
| default: '' | |
| env: | |
| UV_SCRIPT_NAME_LIST: 'example' | |
| jobs: | |
| run-project: | |
| name: Run project on ${{ matrix.python-version }} | |
| runs-on: ${{ matrix.os }} | |
| if: github.event_name == 'push' || github.event.inputs.script_name != '' | |
| strategy: | |
| matrix: | |
| python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
| os: [ubuntu-latest] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "latest" | |
| - name: Install dependencies | |
| run: | | |
| uv sync --all-extras --dev | |
| - name: Run uv script | |
| run: | | |
| if [ -z "${{ github.event.inputs.script_name }}" ]; then | |
| echo "No script name provided, running all scripts" | |
| for script_name in $(echo "${{ env.UV_SCRIPT_NAME_LIST }}" | tr "," " ") | |
| do | |
| echo "Running uv script $script_name" | |
| uv run $script_name | |
| done | |
| else | |
| echo "Running uv script ${{ github.event.inputs.script_name }}" | |
| uv run ${{ github.event.inputs.script_name }} | |
| fi |