Pixi-Release #17
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
| # .github/workflows/pixi.yml | |
| name: Pixi-Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| # Elle tetiklemek için — Actions sekmesinden "Run workflow" butonu çıkar | |
| workflow_dispatch: | |
| inputs: | |
| dry_run: | |
| description: "Dry run (build et ama prefix.dev'e yükleme)" | |
| required: false | |
| default: "false" | |
| type: choice | |
| options: | |
| - "false" | |
| - "true" | |
| permissions: | |
| contents: read | |
| id-token: write | |
| jobs: | |
| test: | |
| name: Test (linux-64) | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # commit push edebilmek için | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| fetch-depth: 0 # tam git geçmişi (commit için gerekli) | |
| - name: Setup pixi | |
| uses: prefix-dev/setup-pixi@v0.9.6 | |
| with: | |
| pixi-version: v0.70.2 | |
| cache: true | |
| auth-host: prefix.dev | |
| auth-token: ${{ secrets.PIXI_TOKEN }} | |
| frozen: false # lock dosyası yoksa veya eskiyse yeniden çöz | |
| locked: false # lock dosyasını zorunlu tutma | |
| - name: Update lock file (değişmişse commit'le) | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| if ! git diff --quiet pixi.lock; then | |
| git add pixi.lock | |
| git commit -m "chore: update pixi.lock [skip ci]" | |
| git push | |
| else | |
| echo "pixi.lock değişmedi." | |
| fi | |
| - name: Format & lint (auto-fix) | |
| run: | | |
| pixi run fmt | |
| pixi run fix || true # fix edilemeyen uyarılar CI'yı durdurmasın | |
| - name: Commit lint fixes (varsa) | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Değişiklik yoksa bu adım sessizce geçer | |
| if ! git diff --quiet; then | |
| git add -A | |
| git commit -m "style: auto-fix ruff lint [skip ci]" | |
| git push | |
| else | |
| echo "Lint düzeltmesi gerekmedi." | |
| fi | |
| - name: Test | |
| run: pixi run test | |
| build-and-publish: | |
| name: Build & Publish conda package | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Update recipe version & sha256 | |
| run: | | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| SHA256=$(curl -sL "https://pypi.org/packages/source/k/kececinumbers/kececinumbers-${VERSION}.tar.gz" | sha256sum | cut -d' ' -f1) | |
| sed -i "s/version: \".*\"/version: \"${VERSION}\"/" conda.recipe/recipe.yaml | |
| sed -i "s/sha256: .*/sha256: ${SHA256}/" conda.recipe/recipe.yaml | |
| echo "Version: $VERSION, SHA256: $SHA256" | |
| - name: Build conda package | |
| uses: prefix-dev/rattler-build-action@v0.2.38 | |
| with: | |
| recipe-path: recipe.yaml # ana dizin | |
| build-args: >- | |
| --target-platform linux-64 | |
| -c conda-forge | |
| -c https://prefix.dev/conda-forge | |
| upload-artifact: true | |
| artifact-name: conda-package-linux-64 | |
| - name: Upload to prefix.dev | |
| # dry_run "true" ise veya hiç input yoksa (tag push) yükleme yapılır | |
| # dry_run "true" seçildiyse bu adım atlanır | |
| if: ${{ github.event.inputs.dry_run != 'true' }} | |
| shell: bash | |
| env: | |
| PIXI_TOKEN: ${{ secrets.PIXI_TOKEN }} | |
| run: | | |
| for pkg in $(find output -type f \( -name "*.conda" -o -name "*.tar.bz2" \)); do | |
| echo "Uploading: $pkg" | |
| rattler-build upload prefix \ | |
| --channel kececinumbers \ | |
| --api-key "$PIXI_TOKEN" \ | |
| "$pkg" || echo "Warning: duplicate, skipping" | |
| done | |
| - name: Dry run info | |
| if: ${{ github.event.inputs.dry_run == 'true' }} | |
| run: | | |
| echo "=== DRY RUN — yükleme yapılmadı ===" | |
| find output -type f \( -name "*.conda" -o -name "*.tar.bz2" \) | |
| # ──────────────────────────────────────────────────────────── | |
| # JOB 3: PyPI'ya da yayınla (opsiyonel) | |
| # ──────────────────────────────────────────────────────────── | |
| publish-pypi: | |
| name: Publish to PyPI | |
| runs-on: ubuntu-latest | |
| needs: test | |
| environment: pypi # GitHub Environment ile koruma (opsiyonel) | |
| permissions: | |
| contents: read | |
| id-token: write # PyPI trusted publishing için | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pixi | |
| uses: prefix-dev/setup-pixi@v0.9.6 | |
| with: | |
| pixi-version: v0.70.2 | |
| cache: true | |
| - name: Build Python package | |
| run: pixi run build # python -m build → dist/ klasörüne yazar | |
| #- name: Publish to PyPI | |
| #uses: pypa/gh-action-pypi-publish@release/v1 | |
| # Trusted publishing kullandığında api-token gerekmez | |
| # Eğer API token kullanıyorsan aşağıyı aç: | |
| # with: | |
| # password: ${{ secrets.PYPI_API_TOKEN }} |