Merge pull request #187 from ByteTheCookies/dependabot/uv/exploiter/p… #9
This file contains hidden or 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 package to PyPI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "exploiter/python/**" | |
| - "cookiefarm/client/**" | |
| - ".github/workflows/pypi-test.yml" | |
| jobs: | |
| build-go: | |
| name: Build Go binaries | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: stable | |
| - name: Install goreleaser | |
| uses: goreleaser/goreleaser-action@v6 | |
| with: | |
| install-only: true | |
| - name: Build with goreleaser | |
| working-directory: cookiefarm | |
| run: goreleaser build --snapshot --clean | |
| - name: Upload Go dist | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: go-dist | |
| path: cookiefarm/dist/ | |
| build-python: | |
| name: Build Python package | |
| needs: build-go | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download Go dist | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: go-dist | |
| path: cookiefarm/dist/ | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Sync binaries into Python package | |
| working-directory: exploiter | |
| run: | | |
| echo "[*] Syncing Go binaries into Python package..." | |
| rm -rf python/src/cookiefarm/bin | |
| mkdir -p python/src/cookiefarm/bin | |
| mkdir -p python/src/cookiefarm/bin/amd64/linux | |
| cp ../cookiefarm/dist/client_linux_amd64*/ckc python/src/cookiefarm/bin/amd64/linux/ckc || true | |
| mkdir -p python/src/cookiefarm/bin/arm64/linux | |
| cp ../cookiefarm/dist/client_linux_arm64*/ckc python/src/cookiefarm/bin/arm64/linux/ckc || true | |
| mkdir -p python/src/cookiefarm/bin/amd64/darwin | |
| cp ../cookiefarm/dist/client_darwin_amd64*/ckc python/src/cookiefarm/bin/amd64/darwin/ckc || true | |
| mkdir -p python/src/cookiefarm/bin/arm64/darwin | |
| cp ../cookiefarm/dist/client_darwin_arm64*/ckc python/src/cookiefarm/bin/arm64/darwin/ckc || true | |
| mkdir -p python/src/cookiefarm/bin/amd64/windows | |
| cp ../cookiefarm/dist/client_windows_amd64*/ckc.exe python/src/cookiefarm/bin/amd64/windows/ckc.exe || true | |
| mkdir -p python/src/cookiefarm/bin/arm64/windows | |
| cp ../cookiefarm/dist/client_windows_arm64*/ckc.exe python/src/cookiefarm/bin/arm64/windows/ckc.exe || true | |
| echo "[+] Sync complete" | |
| - name: Build wheel + sdist | |
| working-directory: exploiter/python | |
| run: uv build | |
| - name: Upload dists | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-dists | |
| path: exploiter/python/dist/ | |
| publish-prod: | |
| name: Publish to PyPI | |
| needs: build-python | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/p/cookiefarm | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download dists | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-dists | |
| path: dist/ | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v5 | |
| - name: Publish to PyPI | |
| run: uv publish |