From b45e24da800bcddb458afba0361adf4963dadeb9 Mon Sep 17 00:00:00 2001 From: y1lm0z Date: Sun, 29 Mar 2026 14:55:19 +0300 Subject: [PATCH] =?UTF-8?q?build=20dosyas=C4=B1=20d=C3=BCzenleme=207?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build.yaml | 78 ++++++++++++++++++++++++++++++------- 1 file changed, 64 insertions(+), 14 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 86f6c69..2895e3b 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -1,4 +1,6 @@ -name: MusicPlayer Fedora Build +name: MusicPlayer Fedora RPM Build +run-name: ${{ gitea.actor }} tarafından Fedora RPM derleniyor 🚀 + on: [push] jobs: @@ -7,10 +9,11 @@ jobs: steps: - name: Gerekli Araçları Kur run: | - dnf install -y git gcc gcc-c++ make cmake pkgconfig curl + dnf install -y git gcc gcc-c++ make cmake pkgconfig curl rpm-build rpmdevtools - name: Kodları Manuel Çek run: | + # Kendi domain adresini kullanarak kodu çekiyoruz git clone https://git.y1lm0z.me/y1lm0z/cmus.git . - name: Bağımlılıkları Kur @@ -28,18 +31,65 @@ jobs: - name: Derle run: | - if [ -f ./configure ]; then ./configure prefix=/usr && make -j$(nproc); - elif [ -f CMakeLists.txt ]; then mkdir -p build && cd build && cmake .. && make -j$(nproc); - else make -j$(nproc); fi + if [ -f ./configure ]; then + ./configure prefix=/usr + make -j$(nproc) + elif [ -f CMakeLists.txt ]; then + mkdir -p build && cd build + cmake .. + make -j$(nproc) + else + make -j$(nproc) + fi - - name: Manuel Release Yükle (API ile) + - name: RPM Paketi Oluştur run: | - # Derlenen dosyayı zipleyelim - tar -czvf cmus-fedora.tar.gz cmus cmus-remote + # RPM klasör yapısını kur + rpmdev-setuptree - # Gitea API kullanarak dosyayı "Attachment" olarak yükle - # Gitea iç network üzerinden token ile gönderiyoruz - # Not: 'secrets.RELEASE_TOKEN' kısmını aşağıda açıklayacağım - curl -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \ - -F "attachment=@cmus-fedora.tar.gz" \ - "https://git.y1lm0z.me/api/v1/repos/${{ gitea.repository }}/releases/latest/assets" || echo "Release bulunamadı, manuel oluşturun." + # Dosyaları sanal bir sistem köküne yerleştir + mkdir -p ~/rpmbuild/BUILDROOT/cmus-custom-1.0-1.x86_64/usr/bin + cp cmus cmus-remote ~/rpmbuild/BUILDROOT/cmus-custom-1.0-1.x86_64/usr/bin/ + + # RPM'in pasaportu olan SPEC dosyasını oluştur + cat < cmus.spec + Name: cmus-custom + Version: 1.0 + Release: 1 + Summary: Custom Fedora Build for Cmus + License: GPL + Group: Applications/Multimedia + %description + y1lm0z tarafından Gitea Actions ile otomatik derlenen cmus paketi. + %files + /usr/bin/cmus + /usr/bin/cmus-remote + EOF + + # Paketi inşa et + rpmbuild -bb cmus.spec + + # Oluşan dosyayı ana dizine al + cp ~/rpmbuild/RPMS/x86_64/*.rpm . + + - name: Release Kontrol Et ve RPM'i Yükle + run: | + RPM_NAME=$(ls *.rpm) + echo "Yüklenecek dosya: $RPM_NAME" + + # 1. Eğer 'v1.0' adında bir sürüm yoksa oluştur (Hata verirse devam et) + curl -X 'POST' "https://git.y1lm0z.me/api/v1/repos/${{ gitea.repository }}/releases" \ + -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \ + -H "Content-Type: application/json" \ + -d '{"tag_name": "v1.0", "name": "Fedora Build v1.0", "body": "Otomatik RPM derlemesi", "draft": false, "prerelease": false}' || true + + # 2. Gitea API'den o sürümün ID numarasını al + RELEASE_ID=$(curl -s -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \ + "https://git.y1lm0z.me/api/v1/repos/${{ gitea.repository }}/releases" | \ + grep -Po '"id":\s*\K\d+' | head -n 1) + + # 3. RPM dosyasını o ID'ye sahip Release içine yükle + curl -X 'POST' \ + -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \ + -F "attachment=@$RPM_NAME" \ + "https://git.y1lm0z.me/api/v1/repos/${{ gitea.repository }}/releases/$RELEASE_ID/assets"