Build and Deploy Packages #17
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 Deploy Packages | |
| on: | |
| push: | |
| tags: | |
| - 'v[0-9]*' | |
| - feature/ci_test | |
| workflow_dispatch: | |
| jobs: | |
| wheels: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| # - os: macos-11 | |
| - os: windows-2019 | |
| architecture: x86 | |
| - os: windows-2019 | |
| architecture: AMD64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: docker/setup-qemu-action@v2 | |
| with: | |
| platforms: arm64 | |
| if: runner.os == 'Linux' | |
| - name: Install Python development packages | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y python3-dev | |
| if: runner.os == 'Linux' | |
| - uses: bus1/cabuild/action/msdevshell@v1 | |
| with: | |
| architecture: x64 | |
| if: runner.os == 'Windows' && matrix.architecture == 'AMD64' | |
| - uses: bus1/cabuild/action/msdevshell@v1 | |
| with: | |
| architecture: x86 | |
| if: runner.os == 'Windows' && matrix.architecture == 'x86' | |
| - name: Generate meson files | |
| run: | | |
| python scripts/generate_meson.py ./src/dbzero/ core | |
| python scripts/generate_meson_tests.py tests/ | |
| - name: Configure git | |
| run: | | |
| git config --global user.email "ci@example.com" | |
| git config --global user.name "CI Builder" | |
| rm -f .gitignore | |
| git add . && git commit -m "Update meson files for build" | |
| - run: pip3 install pipx | |
| - run: pipx run cibuildwheel==2.11.2 | |
| env: | |
| CIBW_SKIP: pp* cp36-* *-musllinux* | |
| CIBW_ARCHS_MACOS: x86_64 arm64 | |
| CIBW_ARCHS_LINUX: x86_64 aarch64 | |
| CIBW_ARCHS_WINDOWS: ${{ matrix.architecture }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| path: wheelhouse/*.whl | |
| sdist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Generate meson files | |
| run: | | |
| python scripts/generate_meson.py ./src/dbzero/ core | |
| python scripts/generate_meson_tests.py tests/ | |
| - name: Configure git | |
| run: | | |
| git config --global user.email "ci@example.com" | |
| git config --global user.name "CI Builder" | |
| rm -f .gitignore | |
| git add . && git commit -m "Update meson files for build" | |
| - run: python -m pip install build meson | |
| - run: python -m build --sdist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| path: dist/*.tar.gz | |
| deploy-to-pypi: | |
| name: Deploy to PyPI (Manual) | |
| runs-on: ubuntu-latest | |
| needs: [wheels, sdist] | |
| if: github.event_name == 'workflow_dispatch' | |
| environment: pypi-deployment | |
| steps: | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: ./dist/ | |
| - name: Flatten artifact structure | |
| run: | | |
| mkdir -p ./upload/ | |
| find ./dist/ -name "*.whl" -exec cp {} ./upload/ \; | |
| find ./dist/ -name "*.tar.gz" -exec cp {} ./upload/ \; | |
| ls -la ./upload/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| repository-url: ${{ vars.REPO_URL }} | |
| username: ${{ vars.USER }} | |
| password: ${{ secrets.PASSWORD }} | |
| packages-dir: ./upload/ | |
| verbose: true |