name: Release on: push: tags: - '*.*.*' jobs: build: name: Build wheels on ${{ matrix.os }} runs-on: ${{ matrix.os }}-latest strategy: matrix: os: [ ubuntu, windows, macos ] steps: - uses: actions/checkout@v3 - name: Build wheels uses: pypa/cibuildwheel@v2.10.1 env: CIBW_PROJECT_REQUIRES_PYTHON: ">=3.7" with: package-dir: . output-dir: dist - uses: actions/upload-artifact@v3 with: name: dist path: ./dist/* Release: needs: [ build ] runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Download artifacts uses: actions/download-artifact@v3 with: name: dist path: dist - name: Install Poetry run: | curl -fsS https://install.python-poetry.org | python - -y - name: Update PATH run: echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Build sdist run: poetry build --format sdist - name: Check distributions run: | ls -la dist - name: Check Version id: check-version run: | [[ "${GITHUB_REF#refs/tags/}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] \ || echo ::set-output name=prerelease::true - name: Create Release uses: ncipollo/release-action@v1 with: artifacts: "dist/*" token: ${{ secrets.GITHUB_TOKEN }} draft: false prerelease: steps.check-version.outputs.prerelease == 'true' - name: Publish to PyPI env: POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} run: | poetry publish