build dosyası düzenleme 9
All checks were successful
MusicPlayer Fedora RPM Build / fedora-compilation (push) Successful in 2m45s
All checks were successful
MusicPlayer Fedora RPM Build / fedora-compilation (push) Successful in 2m45s
This commit is contained in:
@@ -43,12 +43,15 @@ jobs:
|
||||
|
||||
- name: RPM Paketi Oluştur
|
||||
run: |
|
||||
# 1. RPM ağacını oluştur
|
||||
rpmdev-setuptree
|
||||
|
||||
# Çalışma dizinimizin tam yolunu alıyoruz (Örn: /workspace/y1lm0z/cmus)
|
||||
WORKSPACE=$(pwd)
|
||||
# 2. Dosyaları RPM'in varsayılan BUILDROOT klasörüne MANUEL yerleştiriyoruz
|
||||
# Bu sayede SPEC içindeki %install adımına gerek kalmayacak
|
||||
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/
|
||||
|
||||
# SPEC dosyasını oluştur
|
||||
# 3. SPEC dosyasını en basit haliyle oluştur (Sadece paketleme yapar)
|
||||
cat <<EOF > cmus.spec
|
||||
Name: cmus-custom
|
||||
Version: 1.0
|
||||
@@ -59,49 +62,41 @@ jobs:
|
||||
%global debug_package %{nil}
|
||||
|
||||
%description
|
||||
y1lm0z tarafından Gitea Actions ile otomatik derlenen cmus paketi.
|
||||
|
||||
%install
|
||||
mkdir -p %{buildroot}/usr/bin
|
||||
|
||||
# RPM'in kafasına göre klasör aramasını engellemek için dosyaları
|
||||
# direkt olarak derlediğimiz klasörden (WORKSPACE) aldırıyoruz.
|
||||
cp \${WORKSPACE}/cmus %{buildroot}/usr/bin/
|
||||
cp \${WORKSPACE}/cmus-remote %{buildroot}/usr/bin/
|
||||
y1lm0z tarafından otomatik derlenen cmus paketi.
|
||||
|
||||
%files
|
||||
/usr/bin/cmus
|
||||
/usr/bin/cmus-remote
|
||||
EOF
|
||||
|
||||
rpmbuild -bb cmus.spec
|
||||
# 4. Sadece dosyaları paketle (Derleme veya kurulum adımlarını atla)
|
||||
rpmbuild -bb --define "_topdir $HOME/rpmbuild" --buildroot $HOME/rpmbuild/BUILDROOT/cmus-custom-1.0-1.x86_64 cmus.spec
|
||||
|
||||
# 5. RPM'i çalışma dizinine al
|
||||
cp ~/rpmbuild/RPMS/x86_64/*.rpm .
|
||||
|
||||
- name: Release Kontrol Et ve RPM'i Yükle
|
||||
run: |
|
||||
# 1. Dosyaya Commit ID'sini ekleyerek benzersiz bir isim ver (Çakışmayı önler)
|
||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||
NEW_RPM_NAME="cmus-custom-${SHORT_SHA}.x86_64.rpm"
|
||||
mv *.rpm $NEW_RPM_NAME
|
||||
echo "Yüklenecek dosya: $NEW_RPM_NAME"
|
||||
|
||||
# 2. 'v1.0' adında bir Release yoksa oluştur
|
||||
|
||||
# Release oluştur (yoksa)
|
||||
curl -s -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
|
||||
|
||||
# 3. 'v1.0' etiketli sürümün tam ID'sini 'jq' kullanarak güvenli şekilde al
|
||||
# ID al
|
||||
RELEASE_ID=$(curl -s -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||||
"https://git.y1lm0z.me/api/v1/repos/${{ gitea.repository }}/releases/tags/v1.0" | jq -r '.id')
|
||||
|
||||
# ID bulunamazsa güvenli çıkış yap (Sonsuz hatayı önler)
|
||||
if [ -z "$RELEASE_ID" ] || [ "$RELEASE_ID" == "null" ]; then
|
||||
echo "HATA: Release ID bulunamadı! Token veya izinleri kontrol edin."
|
||||
echo "Release ID bulunamadı!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 4. Benzersiz isme sahip RPM dosyasını o ID'ye yükle
|
||||
# Yükle
|
||||
curl -X 'POST' \
|
||||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||||
-F "attachment=@$NEW_RPM_NAME" \
|
||||
|
||||
Reference in New Issue
Block a user