diff --git a/.github/disabled-workflows/release-python.yml b/.github/disabled-workflows/release-python.yml new file mode 100644 index 0000000..461f4ef --- /dev/null +++ b/.github/disabled-workflows/release-python.yml @@ -0,0 +1,322 @@ +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/ + + #sudo apt install libssl-dev + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libssl-dev + sudo apt-get install -y pkg-config + + - 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/ + + - name: Retrieve Type Definitions + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + with: + name: schemas.py + path: ${{ github.workspace }}/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/ + + - name: Retrieve Type Definitions + uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + with: + name: schemas.py + path: ${{ github.workspace }}/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: 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 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_TOKEN }} + with: + command: upload + args: --skip-existing * diff --git a/.github/workflows/build-python.yml b/.github/workflows/build-python.yml new file mode 100644 index 0000000..aa5410d --- /dev/null +++ b/.github/workflows/build-python.yml @@ -0,0 +1,187 @@ +--- +name: Build Python + +on: + workflow_call: + workflow_dispatch: + +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: | # poetry version ${{ github.ref_name }} + 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 + + setup: + name: Setup + runs-on: ubuntu-22.04 + steps: + - name: Checkout repo + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + build: + name: Building Python wheel for - ${{ matrix.settings.os }} - ${{ matrix.settings.target }} + runs-on: ${{ matrix.settings.os || 'ubuntu-latest' }} + needs: + - generate_schemas + - bump-version + - setup + env: + _PACKAGE_VERSION: ${{ github.ref_name }} + # _PACKAGE_VERSION: "2.1.8" + strategy: + fail-fast: false + matrix: + settings: + - os: macos-12 + target: x86_64-apple-darwin + + - os: macos-12 + target: aarch64-apple-darwin + + - os: windows-2022 + target: x86_64-pc-windows-msvc + + - os: ubuntu-22.04 + target: x86_64-unknown-linux-gnu + + - os: ubuntu-22.04 + target: aarch64-unknown-linux-gnu + + steps: + - name: Checkout repo + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Setup Node + uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 + with: + node-version: 18 + + - name: Install rust + uses: dtolnay/rust-toolchain@be73d7920c329f220ce78e0234b8f96b7ae60248 # stable + with: + toolchain: stable + targets: ${{ matrix.settings.target }} + + - name: Cache cargo registry + uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 + with: + key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.os }} + + # Deleting old files that contain versioning info, and replacing them with our modified artifacts. + + - name: Delete existing version files (Linux/MacOS) + if: ${{ matrix.settings.os != 'windows-2022' }} + 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: Delete existing version files (Windows) + if: ${{ matrix.settings.os == 'windows-2022' }} + 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/ + + # End of file replacement + + - 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 + if: ${{ matrix.settings.target != 'x86_64-unknown-linux-gnu' }} + uses: PyO3/maturin-action@a3013db91b2ef2e51420cfe99ee619c8e72a17e6 # v1.40.8 + with: + target: ${{ matrix.settings.target }} + args: --release --find-interpreter --sdist + sccache: "true" + manylinux: "2_28" # https://github.com/pola-rs/polars/pull/12211 + working-directory: ${{ github.workspace }}/crates/infisical-py + + - name: Build wheels (Linux - x86_64) + if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }} + uses: PyO3/maturin-action@a3013db91b2ef2e51420cfe99ee619c8e72a17e6 # v1.40.8 + with: + target: ${{ matrix.settings.target }} + args: --release --find-interpreter --sdist + container: quay.io/pypa/manylinux_2_28_x86_64:2023-11-20-745eb52 + sccache: "true" + manylinux: "2_28" # https://github.com/pola-rs/polars/pull/12211 + working-directory: ${{ github.workspace }}/crates/infisical-py + + - name: Upload wheels + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 + with: + name: infisical_python-${{ env._PACKAGE_VERSION }}-${{ matrix.settings.target }} + path: ${{ github.workspace }}/target/wheels/infisical_python*.whl + + - name: Upload sdists + if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }} # we only need one sdist + uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 # v4.3.0 + with: + name: infisical_python-${{ env._PACKAGE_VERSION }}-sdist + path: ${{ github.workspace }}/target/wheels/infisical_python-*.tar.gz diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml index 461f4ef..bbd5138 100644 --- a/.github/workflows/release-python.yml +++ b/.github/workflows/release-python.yml @@ -1,322 +1,60 @@ -name: Release Python SDK -run-name: Release Python SDK +--- +name: Publish 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 + - "*.*.*" # version, e.g. 1.0.0 jobs: - generate_schemas: - uses: ./.github/workflows/generate-schemas.yml - - test-rust-crate: - uses: ./.github/workflows/rust-test.yml + build-python: + uses: ./.github/workflows/build-python.yml - bump-version: - name: Version changes + setup: needs: - - generate_schemas - - test-rust-crate - runs-on: ubuntu-latest - if: startsWith(github.ref, 'refs/tags/') + - build-python + name: Setup + runs-on: ubuntu-22.04 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 + - name: Checkout repo 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/ - - #sudo apt install libssl-dev - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y libssl-dev - sudo apt-get install -y pkg-config - - - 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 + publish: + name: Publish + runs-on: ubuntu-22.04 needs: - - bump-version - - generate_schemas - - sdist - strategy: - matrix: - target: [x64, x86] + - setup 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 + - name: Install Python + uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5.0.0 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/ + python-version: "3.9" - - name: Download __init__.py artifact - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 - with: - name: __init__.py - path: ./crates/infisical-py/infisical_client/ + - name: Install twine + run: pip install twine - - name: Retrieve Type Definitions - uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2 + - name: Download artifacts + uses: actions/download-artifact@v4 with: - name: schemas.py - path: ${{ github.workspace }}/crates/infisical-py/infisical_client/ + path: ${{ github.workspace }}/target/wheels/dist - - 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: List packages + run: ls -R ./target/wheels/dist + shell: bash - - name: Delete existing version files + - name: Move files + working-directory: ${{ github.workspace }}/target/wheels/dist run: | - rm -rf ./crates/infisical-py/Cargo.toml - rm -rf ./crates/infisical-py/pyproject.toml - rm -rf ./crates/infisical-py/infisical_client/__init__.py + find . -maxdepth 2 -type f -print0 | xargs -0 mv -t . + rm -rf */ - - 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: Check + working-directory: ${{ github.workspace }}/target/wheels + run: twine check dist/* - - 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/ - - - 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: 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 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 + - name: Publish + working-directory: ${{ github.workspace }}/target/wheels env: - MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} - with: - command: upload - args: --skip-existing * + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + run: twine upload --repository pypi dist/*