Release Python SDK #1
Workflow file for this run
This file contains 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: Release Python SDK | |
run-name: Release Python SDK | |
on: | |
push: | |
tags: | |
- "*.*.*" | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.sha }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
generate_schemas: | |
uses: ./.github/workflows/generate-schemas.yml | |
test-rust-crate: | |
uses: ./.github/workflows/rust-test.yml | |
bump-version: | |
name: Version changes | |
needs: | |
- generate_schemas | |
- test-rust-crate | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: ${{ github.head_ref }} | |
- name: Install python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Bump versions (pyproject.toml / Cargo.toml) | |
run: | | |
cd ./crates/infisical-py | |
pip install poetry | |
poetry self add poetry-bumpversion | |
poetry version ${{ github.ref_name }} | |
cd ../.. | |
- name: Upload Cargo.toml artifact | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
with: | |
name: Cargo.toml | |
path: ./crates/infisical-py/Cargo.toml | |
- name: Upload pyproject.toml artifact | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
with: | |
name: pyproject.toml | |
path: ./crates/infisical-py/pyproject.toml | |
- name: Upload __init__.py artifact | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3 | |
with: | |
name: __init__.py | |
path: ./crates/infisical-py/infisical_client/__init__.py | |
linux: | |
runs-on: ubuntu-20.04 | |
needs: | |
- bump-version | |
- sdist | |
strategy: | |
matrix: | |
target: [x86_64, x86, aarch64, armv7, s390x, ppc64le] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: ${{ github.head_ref }} | |
- name: Delete existing version files | |
run: | | |
rm -rf ./crates/infisical-py/Cargo.toml | |
rm -rf ./crates/infisical-py/pyproject.toml | |
rm -rf ./crates/infisical-py/infisical_client/__init__.py | |
- name: Download Cargo.toml artifact | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: Cargo.toml | |
path: ./crates/infisical-py/ | |
- name: Download pyproject.toml artifact | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: pyproject.toml | |
path: ./crates/infisical-py/ | |
- name: Download __init__.py artifact | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: __init__.py | |
path: ./crates/infisical-py/infisical_client/ | |
- name: Retrieve Type Definitions | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: schemas.py | |
path: ${{ github.workspace }}/crates/infisical-py/infisical_client/ | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
env: | |
# Make psm compile, see https://github.com/rust-lang/stacker/issues/79 | |
CFLAGS_s390x_unknown_linux_gnu: "-march=z10" | |
# Workaround ring 0.17 build issue | |
CFLAGS_aarch64_unknown_linux_gnu: "-D__ARM_ARCH=8" | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --find-interpreter --verbose --manifest-path ./crates/infisical-py/Cargo.toml | |
sccache: "true" | |
manylinux: auto | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
windows: | |
runs-on: windows-latest | |
needs: | |
- bump-version | |
- generate_schemas | |
- sdist | |
strategy: | |
matrix: | |
target: [x64, x86] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Delete existing version files | |
run: | | |
del ./crates/infisical-py/Cargo.toml | |
del ./crates/infisical-py/pyproject.toml | |
del ./crates/infisical-py/infisical_client/__init__.py | |
- name: Download Cargo.toml artifact | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: Cargo.toml | |
path: ./crates/infisical-py/ | |
- name: Download pyproject.toml artifact | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: pyproject.toml | |
path: ./crates/infisical-py/ | |
- name: Download __init__.py artifact | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: __init__.py | |
path: ./crates/infisical-py/infisical_client/ | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
architecture: ${{ matrix.target }} | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --verbose --manifest-path ./crates/infisical-py/Cargo.toml | |
sccache: "true" | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
macos: | |
runs-on: macos-latest | |
needs: | |
- bump-version | |
- generate_schemas | |
- sdist | |
strategy: | |
matrix: | |
target: [aarch64, x86_64] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
- name: Delete existing version files | |
run: | | |
rm -rf ./crates/infisical-py/Cargo.toml | |
rm -rf ./crates/infisical-py/pyproject.toml | |
rm -rf ./crates/infisical-py/infisical_client/__init__.py | |
- name: Download Cargo.toml artifact | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: Cargo.toml | |
path: ./crates/infisical-py/ | |
- name: Download pyproject.toml artifact | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: pyproject.toml | |
path: ./crates/infisical-py/ | |
- name: Download __init__.py artifact | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: __init__.py | |
path: ./crates/infisical-py/infisical_client/ | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Build wheels | |
uses: PyO3/maturin-action@v1 | |
with: | |
target: ${{ matrix.target }} | |
args: --release --out dist --verbose --manifest-path ./crates/infisical-py/Cargo.toml | |
sccache: "true" | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
sdist: | |
runs-on: ubuntu-latest | |
needs: | |
- bump-version | |
steps: | |
- name: Checkout | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: ${{ github.head_ref }} | |
- name: Delete existing version files | |
run: | | |
rm -rf ./crates/infisical-py/Cargo.toml | |
rm -rf ./crates/infisical-py/pyproject.toml | |
rm -rf ./crates/infisical-py/infisical_client/__init__.py | |
- name: Download Cargo.toml artifact | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: Cargo.toml | |
path: ./crates/infisical-py/ | |
- name: Download pyproject.toml artifact | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: pyproject.toml | |
path: ./crates/infisical-py/ | |
- name: Download __init__.py artifact | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 | |
with: | |
name: __init__.py | |
path: ./crates/infisical-py/infisical_client/ | |
- name: Build sdist | |
uses: PyO3/maturin-action@v1 | |
with: | |
command: sdist | |
args: --out dist --manifest-path ./crates/infisical-py/Cargo.toml | |
- name: Upload sdist | |
uses: actions/upload-artifact@v3 | |
with: | |
name: wheels | |
path: dist | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
# linux, windows | |
needs: [sdist, macos, linux, windows] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels | |
- name: Publish to PyPI | |
uses: PyO3/maturin-action@v1 | |
env: | |
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_RELEASE_TOKEN }} | |
with: | |
command: upload | |
args: --skip-existing * |