name: Package env: PIP: pip PYTHON: python on: push: tags: - "[0-9]+.[0-9]+.[0-9]+*" jobs: package: permissions: contents: write runs-on: ${{ matrix.os }} strategy: matrix: python-version: [3.9] os: [ubuntu-latest, macos-10.15, windows-latest] steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} - uses: syphar/restore-virtualenv@v1.2 id: cache-virtualenv - uses: syphar/restore-pip-download-cache@v1 if: steps.cache-virtualenv.outputs.cache-hit != 'true' - name: Install build dependencies run: | python -m pip install --upgrade --upgrade-strategy eager -r requirements_dev.txt - name: Install Windows build dependencies run: | choco install -y zip if: runner.os == 'Windows' - name: Install macos dependencies run: | brew install icu4c pkg-config export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"; export PATH="/usr/local/opt/icu4c/bin:/usr/local/opt/icu4c/sbin:$PATH" python -m pip install --no-binary=pyicu pyicu if: runner.os == 'macOS' - name: Install linux dependencies run: | sudo apt-get install pkg-config libicu-dev export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"; export PATH="/usr/local/opt/icu4c/bin:/usr/local/opt/icu4c/sbin:$PATH" python -m pip install --no-binary=pyicu pyicu if: runner.os == 'Linux' - name: Build, Install and Test PyPi packages run: | make clean pydist python -m pip install "dist/$(python setup.py --fullname)-py3-none-any.whl[all]" python -m flake8 python -m pytest - name: "Publish distribution 📦 to PyPI" if: startsWith(github.ref, 'refs/tags/') && runner.os == 'Linux' uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_API_TOKEN }} packages_dir: dist - name: Build PyInstaller package run: | make dist - name: Get release name if: startsWith(github.ref, 'refs/tags/') shell: bash run: | git fetch --depth=1 origin +refs/tags/*:refs/tags/* # github is dumb echo "release_name=$(git tag -l --format "%(refname:strip=2): %(contents:lines=1)" ${{ github.ref_name }})" >> $GITHUB_ENV - name: Release uses: softprops/action-gh-release@v1 if: startsWith(github.ref, 'refs/tags/') with: name: "${{ env.release_name }}" prerelease: "${{ contains(github.ref, '-') }}" # alpha-releases should be 1.3.0-alpha.x full releases should be 1.3.0 draft: false files: | dist/!(*Linux).zip dist/*${{ fromJSON('["never", ""]')[runner.os == 'Linux'] }}.whl