mirror of
https://github.com/darkzoul5/YoutubePlaylistSync.git
synced 2026-07-03 12:34:00 +03:00
170 lines
5.8 KiB
YAML
170 lines
5.8 KiB
YAML
name: Build Release Packages
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
#tags:
|
|
#- "v*"
|
|
|
|
jobs:
|
|
determine-next-tag:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
next_tag: ${{ steps.set_tag.outputs.next_tag }}
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://gitea.com/actions/checkout@v5
|
|
|
|
- name: Determine next version tag
|
|
id: set_tag
|
|
run: |
|
|
git fetch --tags
|
|
|
|
LATEST_TAG=$(git tag -l "v*.*.*" | sort -V | tail -n1)
|
|
echo "Latest tag: $LATEST_TAG"
|
|
|
|
if [ -z "$LATEST_TAG" ]; then
|
|
NEXT_TAG="v0.0.1"
|
|
else
|
|
PATCH=$(echo $LATEST_TAG | awk -F. '{print $3}')
|
|
MAJOR=$(echo $LATEST_TAG | awk -F. '{print $1}' | tr -d 'v')
|
|
MINOR=$(echo $LATEST_TAG | awk -F. '{print $2}')
|
|
PATCH=$((PATCH+1))
|
|
NEXT_TAG="v${MAJOR}.${MINOR}.${PATCH}"
|
|
fi
|
|
|
|
echo "Next tag: $NEXT_TAG"
|
|
echo "next_tag=$NEXT_TAG" >> $GITHUB_OUTPUT
|
|
|
|
- name: Create new tag
|
|
run: |
|
|
git config user.name "Gitea Actions"
|
|
git config user.email "actions@gitea.local"
|
|
git tag ${{ steps.set_tag.outputs.next_tag }}
|
|
git push origin ${{ steps.set_tag.outputs.next_tag }}
|
|
|
|
|
|
windows-package:
|
|
runs-on: ubuntu-latest
|
|
needs: determine-next-tag
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://gitea.com/actions/checkout@v5
|
|
|
|
- name: Set up Python
|
|
uses: https://gitea.com/actions/setup-python@v6
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install --upgrade pip
|
|
sudo apt update
|
|
sudo apt install -y unzip zip curl
|
|
|
|
- name: Prepare Windows package
|
|
run: |
|
|
set -e
|
|
mkdir -p dist/windows
|
|
cp yt-playlist-main.py dist/windows/
|
|
cp yt-playlist-config.json dist/windows/
|
|
|
|
mkdir -p dist/windows/bin
|
|
|
|
# yt-dlp
|
|
curl -L -o dist/windows/bin/yt-dlp.exe https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe
|
|
|
|
# FFmpeg Windows static
|
|
curl -L -o dist/windows/ffmpeg.zip https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip
|
|
unzip -q dist/windows/ffmpeg.zip -d dist/windows/ffmpeg_temp
|
|
mv $(find dist/windows/ffmpeg_temp -name ffmpeg.exe | head -n 1) dist/windows/bin/ffmpeg.exe
|
|
|
|
# aria2c Windows static
|
|
curl -L -o dist/windows/aria2c.zip https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip
|
|
unzip dist/windows/aria2c.zip -d dist/windows/
|
|
mv dist/windows/aria2-1.37.0-win-64bit-build1/aria2c.exe dist/windows/bin/aria2c.exe
|
|
|
|
# Remove temp files before zipping
|
|
rm -rf dist/windows/ffmpeg_temp dist/windows/aria2-1.37.0-win-64bit-build1
|
|
|
|
# Zip everything
|
|
cd dist/windows
|
|
zip -r ../../yt-playlist-windows-${{ needs.determine-next-tag.outputs.next_tag }}.zip *
|
|
cd ../..
|
|
|
|
- name: Upload Windows release
|
|
uses: https://gitea.com/actions/gitea-release-action@v1
|
|
with:
|
|
files: yt-playlist-windows-${{ needs.determine-next-tag.outputs.next_tag }}.zip
|
|
tag_name: ${{ needs.determine-next-tag.outputs.next_tag }}
|
|
name: ${{ needs.determine-next-tag.outputs.next_tag }}
|
|
|
|
linux-package:
|
|
runs-on: ubuntu-latest
|
|
needs: determine-next-tag
|
|
steps:
|
|
- name: Checkout code
|
|
uses: https://gitea.com/actions/checkout@v5
|
|
|
|
- name: Set up Python
|
|
uses: https://gitea.com/actions/setup-python@v6
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
pip install --upgrade pip
|
|
sudo apt update
|
|
sudo apt install -y \
|
|
unzip zip curl wget build-essential pkg-config \
|
|
autoconf automake libtool gettext \
|
|
libssl-dev libxml2-dev zlib1g-dev libsqlite3-dev
|
|
|
|
- name: Prepare Linux package
|
|
run: |
|
|
set -e
|
|
mkdir -p dist/linux
|
|
cp yt-playlist-main.py dist/linux/
|
|
cp yt-playlist-config.json dist/linux/
|
|
|
|
mkdir -p dist/linux/bin
|
|
|
|
# yt-dlp
|
|
curl -L -o dist/linux/bin/yt-dlp https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux
|
|
chmod +x dist/linux/bin/yt-dlp
|
|
|
|
# FFmpeg Linux static
|
|
curl -L -o dist/linux/ffmpeg.tar.xz https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
|
|
mkdir -p dist/linux/ffmpeg_temp
|
|
tar -xf dist/linux/ffmpeg.tar.xz -C dist/linux/ffmpeg_temp --strip-components=1
|
|
mv dist/linux/ffmpeg_temp/ffmpeg dist/linux/bin/ffmpeg
|
|
chmod +x dist/linux/bin/ffmpeg
|
|
|
|
# Build aria2c Linux static
|
|
mkdir -p dist/linux/aria2c_build
|
|
cd dist/linux/aria2c_build
|
|
wget https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0.tar.gz
|
|
tar -xzf aria2-1.37.0.tar.gz
|
|
cd aria2-1.37.0
|
|
autoreconf -i
|
|
./configure ARIA2_STATIC=yes --with-openssl
|
|
make -j$(nproc)
|
|
cp src/aria2c ../../bin/aria2c
|
|
cd ../../
|
|
chmod +x dist/linux/bin/aria2c
|
|
|
|
# Remove temp files before zipping
|
|
rm -rf dist/linux/ffmpeg_temp dist/linux/aria2c_build
|
|
|
|
# Zip everything at top level
|
|
cd dist/linux
|
|
zip -r ../../yt-playlist-linux-${{ needs.determine-next-tag.outputs.next_tag }}.zip *
|
|
cd ../..
|
|
|
|
- name: Upload Linux release
|
|
uses: https://gitea.com/actions/gitea-release-action@v1
|
|
with:
|
|
files: yt-playlist-linux-${{ needs.determine-next-tag.outputs.next_tag }}.zip
|
|
tag_name: ${{ needs.determine-next-tag.outputs.next_tag }}
|
|
name: ${{ needs.determine-next-tag.outputs.next_tag }} |