SynCode v0.4.1 #1
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 and publish to PyPI | ||
| on: | ||
| release: | ||
| types: [published] | ||
| workflow_dispatch: # Allows you to run this workflow manually from the Actions tab | ||
| jobs: | ||
| build_wheels: | ||
| name: Build wheels on ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, windows-latest, macos-latest] | ||
| python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | ||
| exclude: | ||
| # Add any exclusions if certain OS/Python combinations are problematic | ||
| # - os: macos-latest | ||
| # python-version: '3.12' | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # Gets all history for proper versioning | ||
| - name: Set up Python ${{ matrix.python-version }} | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: ${{ matrix.python-version }} | ||
| - name: Install build dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install build wheel setuptools | ||
| - name: Build wheels | ||
| run: | | ||
| python -m build --wheel --outdir dist/ | ||
| - name: Upload wheels | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: wheels-${{ matrix.os }}-${{ matrix.python-version }} | ||
| path: dist/*.whl | ||
| build_sdist: | ||
| name: Build source distribution | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 # Gets all history for proper versioning | ||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: '3.12' | ||
| - name: Install build dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install build twine | ||
| - name: Build sdist | ||
| run: | | ||
| python -m build --sdist --outdir dist/ | ||
| - name: Check metadata | ||
| run: | | ||
| twine check dist/*.tar.gz | ||
| - name: Upload sdist | ||
| uses: actions/upload-artifact@v3 | ||
| with: | ||
| name: sdist | ||
| path: dist/*.tar.gz | ||
| publish: | ||
| name: Publish to PyPI | ||
| needs: [build_wheels, build_sdist] | ||
| runs-on: ubuntu-latest | ||
| # Only publish on release | ||
| if: github.event_name == 'release' && github.event.action == 'published' | ||
| environment: | ||
| name: pypi | ||
| url: https://pypi.org/project/syncode/ | ||
| permissions: | ||
| id-token: write # For PyPI trusted publishing | ||
| steps: | ||
| - name: Download all artifacts | ||
| uses: actions/download-artifact@v3 | ||
| with: | ||
| path: dist | ||
| - name: Flatten dist directory | ||
| run: | | ||
| mkdir -p flat_dist | ||
| find dist -type f -name "*.whl" -o -name "*.tar.gz" -exec cp {} flat_dist \; | ||
| ls -la flat_dist | ||
| - name: Publish to PyPI | ||
| uses: pypa/gh-action-pypi-publish@release/v1 | ||
| with: | ||
| packages-dir: flat_dist | ||
| verbose: true | ||
| # skip-existing: true # Uncomment if you want to skip existing versions | ||