Skip to content

Deployment

Deployment #8

Workflow file for this run

name: Deployment
on:
# this workflow can only be manually triggered for now.
workflow_dispatch:
inputs:
deploy:
description: 'Where to deploy the artifacts? Only build (build), deploy to test PyPI (test), or deploy to PyPI (prod).'
required: true
type: choice
default: 'test'
options:
- build
- test
- prod
jobs:
create-sdist:
if: github.repository == 'facebookresearch/pyvrs'
runs-on: ubuntu-latest
name: Create source Distribution
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Upgrade pip
run: |
python3 -m pip install --upgrade pip
- name: Create Source Distribution
run: |
python3 -m pip install setuptools wheel twine
python3 setup.py sdist
- uses: actions/upload-artifact@v2
with:
name: python-package-distributions
path: dist/*.tar.gz
build-wheels:
if: github.repository == 'facebookresearch/pyvrs'
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.9'
- name: Upgrade pip
run: |
python3 -m pip install --upgrade pip
- name: Install cibuildwheel
run: |
python3 -m pip install cibuildwheel==2.17.0
- name: Build wheels for CPython
run: |
python3 -m cibuildwheel --output-dir dist
env:
CIBW_ARCHS_LINUX: x86_64
CIBW_ARCHS_MACOS: "x86_64 arm64"
CIBW_BUILD: "cp39-*64 cp310-*64 cp311-*64 cp312-*64"
CIBW_BEFORE_BUILD_LINUX: bash scripts/install-manylinux-deps.sh
CIBW_BEFORE_BUILD_MACOS: bash scripts/install-macos-deps.sh
CIBW_SKIP: "*-manylinux_i686 *musllinux*"
- uses: actions/upload-artifact@v2
with:
name: python-package-distributions
path: dist
publish-to-pypi:
runs-on: ubuntu-latest
needs:
- build-wheels
- create-sdist
steps:
- name: Download wheels from previous jobs
# by default this will download all artifacts
uses: actions/download-artifact@v3
with:
name: python-package-distributions
# PyPI publish action uploads everything under dist/* by default
path: dist
- name: Display the list of artifacts
run: ls -R dist
- name: Publish to Test PyPI
if: github.event.inputs.deploy == 'test'
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: __token__
password: ${{ secrets.TEST_PYPI_TOKEN }}
repository_url: https://test.pypi.org/legacy/
skip_existing: true
verbose: true
- name: Publish to PyPI
if: github.event.inputs.deploy == 'prod' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
verbose: true