Skip to content

Pixi-Release

Pixi-Release #14

Workflow file for this run

# .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: Build conda package
uses: prefix-dev/rattler-build-action@v0.2.38
with:
recipe-path: conda.recipe/recipe.yaml
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 }}