Some checks failed
MusicPlayer Fedora RPM Build / fedora-compilation (push) Failing after 3m6s
99 lines
3.9 KiB
YAML
99 lines
3.9 KiB
YAML
name: MusicPlayer Fedora RPM Build
|
||
run-name: ${{ gitea.actor }} tarafından Fedora RPM derleniyor 🚀
|
||
|
||
on: [push]
|
||
|
||
jobs:
|
||
fedora-compilation:
|
||
runs-on: fedora-latest
|
||
steps:
|
||
- name: Gerekli Araçları Kur
|
||
run: |
|
||
# 'jq' paketini ekledik (Gitea API'den gelen verileri güvenle okumak için)
|
||
dnf install -y git gcc gcc-c++ make cmake pkgconfig curl rpm-build rpmdevtools jq
|
||
|
||
- name: Kodları Manuel Çek
|
||
run: |
|
||
git clone https://git.y1lm0z.me/y1lm0z/cmus.git .
|
||
|
||
- name: Bağımlılıkları Kur
|
||
run: |
|
||
dnf install -y https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm || true
|
||
dnf install -y \
|
||
'pkgconfig(ncursesw)' 'pkgconfig(alsa)' 'pkgconfig(ao)' \
|
||
'pkgconfig(libcddb)' 'pkgconfig(libcdio_cdda)' 'pkgconfig(libdiscid)' \
|
||
'pkgconfig(libavformat)' 'pkgconfig(libavcodec)' 'pkgconfig(libswresample)' \
|
||
'pkgconfig(flac)' 'pkgconfig(jack)' 'pkgconfig(mad)' \
|
||
'pkgconfig(libmodplug)' libmpcdec-devel 'pkgconfig(libsystemd)' \
|
||
'pkgconfig(opusfile)' 'pkgconfig(libpulse)' 'pkgconfig(samplerate)' \
|
||
'pkgconfig(vorbisfile)' 'pkgconfig(wavpack)' \
|
||
faad2-devel libmp4v2-devel
|
||
|
||
- 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
|
||
|
||
- name: RPM Paketi Oluştur
|
||
run: |
|
||
rpmdev-setuptree
|
||
mkdir -p ~/rpmbuild/BUILD/usr/bin
|
||
cp cmus cmus-remote ~/rpmbuild/BUILD/usr/bin/
|
||
|
||
cat <<EOF > cmus.spec
|
||
Name: cmus-custom
|
||
Version: 1.0
|
||
Release: 1
|
||
Summary: Custom Fedora Build for Cmus
|
||
License: GPL
|
||
%define _build_id_links none
|
||
%global debug_package %{nil}
|
||
|
||
%description
|
||
y1lm0z tarafından Gitea Actions ile otomatik derlenen cmus paketi.
|
||
|
||
%install
|
||
mkdir -p %{buildroot}/usr/bin
|
||
cp %{_builddir}/usr/bin/cmus %{buildroot}/usr/bin/
|
||
cp %{_builddir}/usr/bin/cmus-remote %{buildroot}/usr/bin/
|
||
|
||
%files
|
||
/usr/bin/cmus
|
||
/usr/bin/cmus-remote
|
||
EOF
|
||
|
||
rpmbuild -bb cmus.spec
|
||
cp ~/rpmbuild/RPMS/x86_64/*.rpm .
|
||
|
||
- name: Release Kontrol Et ve RPM'i Yükle
|
||
run: |
|
||
# 1. Dosyaya benzersiz bir isim verelim (Aynı isimde dosya yükleme hatasını önlemek için)
|
||
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
|
||
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 %100 güvenli şekilde 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 '.id')
|
||
|
||
# 4. Benzersiz isme sahip RPM dosyasını o ID'ye yükle
|
||
curl -X 'POST' \
|
||
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
||
-F "attachment=@$NEW_RPM_NAME" \
|
||
"https://git.y1lm0z.me/api/v1/repos/${{ gitea.repository }}/releases/$RELEASE_ID/assets"
|