mirror of
https://github.com/darkzoul5/YoutubePlaylistSync.git
synced 2026-07-04 21:04:01 +03:00
rename .gitea to .github
This commit is contained in:
@@ -0,0 +1,248 @@
|
||||
name: Build Release Packages
|
||||
|
||||
on:
|
||||
push:
|
||||
#branches:
|
||||
#- test
|
||||
tags:
|
||||
- "v*.*.*"
|
||||
|
||||
jobs:
|
||||
build-windows-package:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: https://gitea.com/actions/checkout@v5
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y unzip zip curl
|
||||
|
||||
- name: Extract tag name
|
||||
run: |
|
||||
REF="${GITEA_REF:-$GITHUB_REF}"
|
||||
TAG="${REF#refs/tags/}"
|
||||
echo "TAG=$TAG" >> $GITHUB_ENV
|
||||
|
||||
- name: Prepare Windows package
|
||||
run: |
|
||||
set -e
|
||||
WORKSPACE_ROOT="${GITEA_WORKSPACE:-$PWD}"
|
||||
mkdir -p "$WORKSPACE_ROOT/dist/windows"
|
||||
cp "$WORKSPACE_ROOT/yt-playlist-main.py" "$WORKSPACE_ROOT/dist/windows/"
|
||||
|
||||
mkdir -p "$WORKSPACE_ROOT/dist/windows/bin"
|
||||
|
||||
# yt-dlp
|
||||
curl -L -o "$WORKSPACE_ROOT/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 "$WORKSPACE_ROOT/dist/windows/ffmpeg.zip" https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip
|
||||
unzip -q "$WORKSPACE_ROOT/dist/windows/ffmpeg.zip" -d "$WORKSPACE_ROOT/dist/windows/ffmpeg_temp"
|
||||
mv $(find "$WORKSPACE_ROOT/dist/windows/ffmpeg_temp" -name ffmpeg.exe | head -n 1) "$WORKSPACE_ROOT/dist/windows/bin/ffmpeg.exe"
|
||||
|
||||
# aria2c Windows static
|
||||
curl -L -o "$WORKSPACE_ROOT/dist/windows/aria2c.zip" https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip
|
||||
unzip "$WORKSPACE_ROOT/dist/windows/aria2c.zip" -d "$WORKSPACE_ROOT/dist/windows/"
|
||||
mv "$WORKSPACE_ROOT/dist/windows/aria2-1.37.0-win-64bit-build1/aria2c.exe" "$WORKSPACE_ROOT/dist/windows/bin/aria2c.exe"
|
||||
|
||||
# Remove temp files before zipping
|
||||
rm -rf "$WORKSPACE_ROOT/dist/windows/ffmpeg_temp" "$WORKSPACE_ROOT/dist/windows/aria2-1.37.0-win-64bit-build1" "$WORKSPACE_ROOT/dist/windows/ffmpeg.zip" "$WORKSPACE_ROOT/dist/windows/aria2c.zip"
|
||||
|
||||
cd "$WORKSPACE_ROOT/dist/windows"
|
||||
ZIP_NAME="yt-playlist-windows-${TAG}.zip"
|
||||
zip -r "$WORKSPACE_ROOT/$ZIP_NAME" *
|
||||
echo "ZIP_PATH=$WORKSPACE_ROOT/$ZIP_NAME" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload Windows artifact
|
||||
uses: christopherhx/gitea-upload-artifact@v4
|
||||
with:
|
||||
name: windows-zip
|
||||
path: ${{ env.ZIP_PATH }}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
build-linux-package:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: https://gitea.com/actions/checkout@v5
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install -y unzip zip curl wget build-essential \
|
||||
pkg-config libssl-dev zlib1g-dev
|
||||
|
||||
|
||||
- name: Extract tag name
|
||||
run: |
|
||||
REF="${GITEA_REF:-$GITHUB_REF}"
|
||||
TAG="${REF#refs/tags/}"
|
||||
echo "TAG=$TAG" >> $GITHUB_ENV
|
||||
|
||||
- name: Prepare Linux package
|
||||
run: |
|
||||
set -e
|
||||
WORKSPACE_ROOT="${GITEA_WORKSPACE:-$PWD}"
|
||||
mkdir -p "$WORKSPACE_ROOT/dist/linux"
|
||||
cp "$WORKSPACE_ROOT/yt-playlist-main.py" "$WORKSPACE_ROOT/dist/linux/"
|
||||
|
||||
mkdir -p "$WORKSPACE_ROOT/dist/linux/bin"
|
||||
|
||||
# yt-dlp
|
||||
curl -L -o "$WORKSPACE_ROOT/dist/linux/bin/yt-dlp" https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp_linux
|
||||
chmod +x "$WORKSPACE_ROOT/dist/linux/bin/yt-dlp"
|
||||
|
||||
# FFmpeg Linux static
|
||||
curl -L -o "$WORKSPACE_ROOT/dist/linux/ffmpeg.tar.xz" https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
|
||||
mkdir -p "$WORKSPACE_ROOT/dist/linux/ffmpeg_temp"
|
||||
tar -xf "$WORKSPACE_ROOT/dist/linux/ffmpeg.tar.xz" -C "$WORKSPACE_ROOT/dist/linux/ffmpeg_temp" --strip-components=1
|
||||
mv "$WORKSPACE_ROOT/dist/linux/ffmpeg_temp/ffmpeg" "$WORKSPACE_ROOT/dist/linux/bin/ffmpeg"
|
||||
chmod +x "$WORKSPACE_ROOT/dist/linux/bin/ffmpeg"
|
||||
|
||||
# aria2c minimal static
|
||||
mkdir -p "$WORKSPACE_ROOT/dist/linux/aria2c_build"
|
||||
cd "$WORKSPACE_ROOT"
|
||||
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
|
||||
CFLAGS="-Os -s" LDFLAGS="-static" ./configure \
|
||||
--enable-static --disable-shared \
|
||||
--disable-libaria2 --without-ca-bundle \
|
||||
--without-libnettle --without-libgcrypt \
|
||||
--without-libssh2 --without-libexpat \
|
||||
--without-libxml2 --without-libsqlite3 \
|
||||
--with-openssl
|
||||
make -j"$(nproc)"
|
||||
strip src/aria2c
|
||||
|
||||
cp src/aria2c "$WORKSPACE_ROOT/dist/linux/bin/aria2c"
|
||||
chmod +x "$WORKSPACE_ROOT/dist/linux/bin/aria2c"
|
||||
|
||||
# Cleanup
|
||||
rm -rf "$WORKSPACE_ROOT/dist/linux/ffmpeg_temp" "$WORKSPACE_ROOT/dist/linux/aria2c_build" "$WORKSPACE_ROOT/dist/linux/ffmpeg.tar.xz" "$WORKSPACE_ROOT/aria2-1.37.0" "$WORKSPACE_ROOT/aria2-1.37.0.tar.gz"
|
||||
|
||||
# GZip everything
|
||||
cd "$WORKSPACE_ROOT/dist/linux"
|
||||
ZIP_NAME="yt-playlist-linux-${TAG}.tar.gz"
|
||||
tar -czf "$WORKSPACE_ROOT/$ZIP_NAME" *
|
||||
echo "ZIP_PATH=$WORKSPACE_ROOT/$ZIP_NAME" >> $GITHUB_ENV
|
||||
|
||||
- name: Upload Linux artifact
|
||||
uses: christopherhx/gitea-upload-artifact@v4
|
||||
with:
|
||||
name: linux-zip
|
||||
path: ${{ env.ZIP_PATH }}
|
||||
|
||||
build-docker-image:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-linux-package]
|
||||
env:
|
||||
REGISTRY_URL: git.darkzoul.org
|
||||
REGISTRY_OWNER: dark_zoul
|
||||
IMAGE_NAME: youtube-playlist-downloader
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: https://gitea.com/actions/checkout@v5
|
||||
|
||||
- name: Extract tag name
|
||||
run: |
|
||||
set -e
|
||||
REF="${GITEA_REF:-$GITHUB_REF}"
|
||||
TAG="${REF#refs/tags/}"
|
||||
echo "TAG=$TAG" >> $GITHUB_ENV
|
||||
|
||||
- name: Download linux-zip artifact
|
||||
uses: christopherhx/gitea-download-artifact@v4
|
||||
with:
|
||||
name: linux-zip
|
||||
|
||||
- name: Extract linux-zip artifact
|
||||
run: |
|
||||
set -e
|
||||
tar -xzf yt-playlist-linux-${TAG}.tar.gz
|
||||
|
||||
- name: Build Docker image with release tag
|
||||
run: docker build ./ -t ${{ env.REGISTRY_URL }}/${{ env.REGISTRY_OWNER }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
|
||||
|
||||
- name: Save Docker image ${TAG} as tar
|
||||
run: |
|
||||
docker save -o docker-image.tar ${{ env.REGISTRY_URL }}/${{ env.REGISTRY_OWNER }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
|
||||
|
||||
- name: Upload docker-image-${TAG} artifact
|
||||
uses: christopherhx/gitea-upload-artifact@v4
|
||||
with:
|
||||
name: docker-image
|
||||
path: docker-image.tar
|
||||
|
||||
- name: Build Docker image as latest (distinct digest)
|
||||
run: docker build ./ --label build_as_latest=true -t ${{ env.REGISTRY_URL }}/${{ env.REGISTRY_OWNER }}/${{ env.IMAGE_NAME }}:latest
|
||||
|
||||
- name: Save Docker image as tar
|
||||
run: |
|
||||
docker save -o docker-image-latest.tar ${{ env.REGISTRY_URL }}/${{ env.REGISTRY_OWNER }}/${{ env.IMAGE_NAME }}:latest
|
||||
|
||||
- name: Upload docker-image-latest artifact
|
||||
uses: christopherhx/gitea-upload-artifact@v4
|
||||
with:
|
||||
name: docker-image-latest
|
||||
path: docker-image-latest.tar
|
||||
|
||||
|
||||
release:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-windows-package, build-linux-package, build-docker-image]
|
||||
env:
|
||||
REGISTRY_URL: git.darkzoul.org
|
||||
REGISTRY_OWNER: dark_zoul
|
||||
IMAGE_NAME: youtube-playlist-downloader
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
uses: christopherhx/gitea-download-artifact@v4
|
||||
|
||||
- name: Extract tag name
|
||||
run: |
|
||||
REF="${GITEA_REF:-$GITHUB_REF}"
|
||||
TAG="${REF#refs/tags/}"
|
||||
echo "TAG=$TAG" >> $GITHUB_ENV
|
||||
|
||||
- name: Login to the Container registry
|
||||
uses: https://gitea.com/docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY_URL }}
|
||||
username: ${{ env.REGISTRY_OWNER }}
|
||||
password: ${{ secrets.MY_REGISTRY_ACCESS_TOKEN }}
|
||||
|
||||
- name: Load docker image from tar
|
||||
run: |
|
||||
set -e
|
||||
docker load -i docker-image/docker-image.tar
|
||||
|
||||
- name: Push Docker image with release tag
|
||||
run: docker push ${{ env.REGISTRY_URL }}/${{ env.REGISTRY_OWNER }}/${{ env.IMAGE_NAME }}:${{ env.TAG }}
|
||||
|
||||
- name: Load docker image from tar
|
||||
run: |
|
||||
set -e
|
||||
docker load -i docker-image-latest/docker-image-latest.tar
|
||||
|
||||
- name: Push Docker image as latest
|
||||
run: docker push ${{ env.REGISTRY_URL }}/${{ env.REGISTRY_OWNER }}/${{ env.IMAGE_NAME }}:latest
|
||||
|
||||
- name: Publish release
|
||||
uses: https://gitea.com/actions/gitea-release-action@v1
|
||||
with:
|
||||
draft: true
|
||||
tag_name: ${{ env.TAG }}
|
||||
name: ${{ env.TAG }}
|
||||
files: |
|
||||
linux-zip/*
|
||||
windows-zip/*
|
||||
Reference in New Issue
Block a user