Skip to content

Version updated from 0.7.3 to 0.7.4 #163

Version updated from 0.7.3 to 0.7.4

Version updated from 0.7.3 to 0.7.4 #163

Workflow file for this run

name: Deployment to PyPI
on:
push:
branches:
- "main"
tags:
- "**"
permissions:
contents: write
jobs:
# Keep the "build" job identical to "python-build.yml".
# TODO(clairbee): include "python-build.yml" instead
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.11"]
runs-on: ${{ matrix.os }}
env:
BIN_DIR: ${{ matrix.os == 'windows-latest' && 'Scripts' || 'bin' }}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
id: cache
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.*') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Prepare environments
run: |
python -m pip install --upgrade pip build
mkdir .venv
python -m venv .venv/build
(. .venv/build/${{ env.BIN_DIR }}/activate && python -m pip install --upgrade pip build && deactivate)
python -m venv .venv/build-cli
(. .venv/build-cli/${{ env.BIN_DIR }}/activate && python -m pip install --upgrade pip build && deactivate)
python -m venv .venv/install
(. .venv/install/${{ env.BIN_DIR }}/activate && python -m pip install --upgrade pip build && deactivate)
- name: Test building and packaging
run: |
(. .venv/build/${{ env.BIN_DIR }}/activate && cd partcad && python -m build && cd .. && deactivate)
(. .venv/build-cli/${{ env.BIN_DIR }}/activate && python -m pip install -r partcad/requirements.txt && deactivate)
(. .venv/build-cli/${{ env.BIN_DIR }}/activate && python -m pip install --no-index --find-links=partcad/dist partcad && deactivate)
cp README.md partcad-cli
(. .venv/build-cli/${{ env.BIN_DIR }}/activate && cd partcad-cli && python -m build && cd .. && deactivate)
- name: Test installation
run: |
(. .venv/install/${{ env.BIN_DIR }}/activate && python -m pip install -r partcad/requirements.txt && deactivate)
(. .venv/install/${{ env.BIN_DIR }}/activate && python -m pip install --no-index --find-links=partcad/dist partcad && deactivate)
(. .venv/install/${{ env.BIN_DIR }}/activate && python -m pip install -r partcad-cli/requirements.txt && deactivate)
(. .venv/install/${{ env.BIN_DIR }}/activate && python -m pip install --no-index --find-links=partcad-cli/dist partcad-cli && deactivate)
# Upload artifact from the selected OS/Python version combination only
- name: Upload "partcad"
if: "matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'"
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: partcad/dist/
- name: Upload "partcad-cli"
if: "matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'"
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: partcad-cli/dist/
publish-to-pypi:
name: Publish to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
steps:
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist
- name: Determine the release tag
if: github.ref == 'refs/heads/main'
run: |
git clone https://github.com/openvmp/partcad partcad-git;
cd partcad-git;
echo "MERGED_TAG=$(git describe --abbrev=0)" >> $GITHUB_ENV
- name: Create GitHub Release
if: github.ref == 'refs/heads/main'
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release create '${{ env.MERGED_TAG }}' --repo '${{ github.repository }}' --notes "";
gh release upload '${{ env.MERGED_TAG }}' dist/** --repo '${{ github.repository }}'
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url:
"${{ github.ref == 'refs/heads/main' &&
'https://upload.pypi.org/legacy/' || 'https://test.pypi.org/legacy/'
}}"
user: __token__
password:
"${{ github.ref == 'refs/heads/main' && secrets.PYPI_KEY ||
secrets.TEST_PYPI_KEY }}"