|
| 1 | +name: Upload Test File to Test PyPI |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + file_path: |
| 7 | + description: 'Path to the file to upload' |
| 8 | + required: true |
| 9 | + default: 'dist/c2pa_python-0.4.0-py3-none-macosx_11_0_arm64.whl' |
| 10 | + |
| 11 | +jobs: |
| 12 | + linux: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + strategy: |
| 16 | + matrix: |
| 17 | + target: [x86_64, aarch64] |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + - uses: actions/setup-python@v5 |
| 21 | + with: |
| 22 | + python-version: "3.10" |
| 23 | + cache: "pip" |
| 24 | + - run: pip install -r requirements.txt |
| 25 | + - name: Setup QEMU |
| 26 | + uses: docker/setup-qemu-action@v1 |
| 27 | + if: ${{ matrix.target == 'aarch64' }} |
| 28 | + - name: Build wheels |
| 29 | + uses: PyO3/maturin-action@v1 |
| 30 | + with: |
| 31 | + target: ${{ matrix.target }} |
| 32 | + maturin-version: "1.2.0" |
| 33 | + args: --release --out dist --find-interpreter |
| 34 | + sccache: "true" |
| 35 | + manylinux: ${{ matrix.target == 'aarch64' && 'manylinux_2_28' || 'auto' }} |
| 36 | + before-script-linux: | |
| 37 | + pip install uniffi-bindgen==0.24.1 |
| 38 | +
|
| 39 | + # ISSUE: https://github.com/sfackler/rust-openssl/issues/2036#issuecomment-1724324145 |
| 40 | + # If we're running on rhel centos, install needed packages. |
| 41 | + if command -v yum &> /dev/null; then |
| 42 | + yum update -y && yum install -y perl-core openssl openssl-devel pkgconfig libatomic |
| 43 | +
|
| 44 | + # If we're running on i686 we need to symlink libatomic |
| 45 | + # in order to build openssl with -latomic flag. |
| 46 | + if [[ ! -d "/usr/lib64" ]]; then |
| 47 | + ln -s /usr/lib/libatomic.so.1 /usr/lib/libatomic.so |
| 48 | + fi |
| 49 | + else |
| 50 | + # If we're running on debian-based system. |
| 51 | + apt update -y && apt-get install -y libssl-dev openssl pkg-config |
| 52 | + fi |
| 53 | + - name: Upload wheels |
| 54 | + uses: actions/upload-artifact@v4 |
| 55 | + with: |
| 56 | + name: wheels-${{ matrix.target }} |
| 57 | + path: dist |
| 58 | + |
| 59 | + sdist: |
| 60 | + runs-on: ubuntu-latest |
| 61 | + |
| 62 | + steps: |
| 63 | + - uses: actions/checkout@v4 |
| 64 | + - name: Build sdist |
| 65 | + uses: PyO3/maturin-action@v1 |
| 66 | + with: |
| 67 | + command: sdist |
| 68 | + args: --out dist |
| 69 | + - name: Upload sdist |
| 70 | + uses: actions/upload-artifact@v4 |
| 71 | + with: |
| 72 | + name: wheels |
| 73 | + path: dist |
| 74 | + |
| 75 | + pypi-publish: |
| 76 | + name: upload release to PyPI |
| 77 | + runs-on: ubuntu-latest |
| 78 | + # Specifying a GitHub environment is optional, but strongly encouraged |
| 79 | + environment: testpublish |
| 80 | + permissions: |
| 81 | + # IMPORTANT: this permission is mandatory for Trusted Publishing |
| 82 | + id-token: write |
| 83 | + steps: |
| 84 | + # retrieve your distributions here |
| 85 | + - name: Download wheels artifact |
| 86 | + uses: actions/download-artifact@v4 |
| 87 | + |
| 88 | + - name: Publish package distributions to PyPI |
| 89 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments