Use the PyPI token secret for DeepGym releases #9
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: DeepGym CI | |
| on: | |
| push: | |
| branches: [main, master] | |
| tags: ['v*'] | |
| paths: | |
| - 'deepgym/**' | |
| - '.github/workflows/deepgym-ci.yml' | |
| pull_request: | |
| branches: [main, master] | |
| paths: | |
| - 'deepgym/**' | |
| - '.github/workflows/deepgym-ci.yml' | |
| defaults: | |
| run: | |
| working-directory: deepgym | |
| jobs: | |
| test: | |
| name: DeepGym Test (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ['3.10', '3.11', '3.12'] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| cache-dependency-path: deepgym/pyproject.toml | |
| - name: Install dependencies | |
| run: pip install -e ".[dev]" | |
| - name: Lint (ruff) | |
| run: ruff check src/ | |
| - name: Format check (ruff) | |
| run: ruff format --check src/ | |
| - name: Run tests | |
| run: pytest --tb=short -q | |
| env: | |
| DEEPGYM_NO_AUTH: 'true' | |
| publish: | |
| name: Publish DeepGym to PyPI | |
| runs-on: ubuntu-latest | |
| needs: test | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
| environment: pypi | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| cache: pip | |
| cache-dependency-path: deepgym/pyproject.toml | |
| - name: Build package | |
| run: | | |
| pip install hatch | |
| hatch build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: deepgym/dist/ | |
| user: __token__ | |
| password: ${{ secrets.PYPI_API_TOKEN }} |