diff --git a/.github/workflows/aseprite_build_deploy.yml b/.github/workflows/aseprite_build_deploy.yml index 9aee0754..777e2232 100644 --- a/.github/workflows/aseprite_build_deploy.yml +++ b/.github/workflows/aseprite_build_deploy.yml @@ -63,7 +63,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [windows-latest, ubuntu-latest, macOS-latest] + os: [windows-latest] fail-fast: false steps: - name: (Windows) Install dependencies diff --git a/.github/workflows/blank.yml b/.github/workflows/blank.yml new file mode 100644 index 00000000..9aee0754 --- /dev/null +++ b/.github/workflows/blank.yml @@ -0,0 +1,135 @@ +name: Build and deploy Aseprite + +on: + schedule: + - cron: '0 0 * * *' + push: + branches: + - master + +env: + BUILD_TYPE: Release + +jobs: + check-version: + name: Check latest Aseprite release + runs-on: ubuntu-latest + outputs: + download_url: ${{ steps.version_info.outputs.download_url }} + latest_tag: ${{ steps.version_info.outputs.latest_tag }} + should_build: ${{ steps.should_build.outputs.should_build }} + upload_url: ${{ steps.create_release.outputs.upload_url }} + steps: + - name: Get latest version info + id: version_info + run: | + data=$(curl -sL https://api.github.com/repos/aseprite/aseprite/releases/latest) + LATEST_TAG=$(echo "${data}" | jq -r '.tag_name') + DOWNLOAD_URL=$(echo "${data}" | jq -r '.assets[].browser_download_url') + VERSION_INFO=$(echo "${data}" | jq -r '.body') + + echo "${LATEST_TAG}" > ${LATEST_TAG}.txt + echo "::set-output name=latest_tag::${LATEST_TAG}" + echo "::set-output name=download_url::${DOWNLOAD_URL}" + echo "::set-output name=version_info::${VERSION_INFO}" + - name: Load version from cache + id: version_check + uses: actions/cache@v2 + with: + path: ${{ steps.version_info.outputs.latest_tag }}.txt + key: cached_version + - name: Should we start new build? + id: should_build + if: steps.version_check.outputs.cache-hit != 'true' + run: echo "::set-output name=should_build::true" + - name: Create Release + id: create_release + if: steps.should_build.outputs.should_build + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.version_info.outputs.latest_tag }} + release_name: Release Aseprite ${{ steps.version_info.outputs.latest_tag }} + body: | + ${{ steps.version_info.outputs.version_info }} + draft: true + prerelease: false + + build-aseprite: + name: Build Aseprite + needs: check-version + if: ${{ needs.check-version.outputs.should_build }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macOS-latest] + fail-fast: false + steps: + - name: (Windows) Install dependencies + if: matrix.os == 'windows-latest' + uses: seanmiddleditch/gha-setup-ninja@v1 + - name: (Ubuntu) Install dependencies + if: matrix.os == 'ubuntu-latest' + run: sudo apt install -y cmake ninja-build libxcursor-dev libxi-dev libgl1-mesa-dev + - name: (macOS) Install dependencies + if: matrix.os == 'macOS-latest' + run: brew install ninja p7zip + - name: Get Skia from cache + id: skia-cache + uses: actions/cache@v2 + with: + path: skia + key: skia-${{ matrix.os }}-cache + - name: Download Skia if not in cache + if: steps.skia-cache.outputs.cache-hit != 'true' + run: | + curl -o Skia-${{ runner.os }}-Release-X64.zip -L https://github.com/aseprite/skia/releases/download/m81-b607b32047/Skia-${{ runner.os }}-Release-X64.zip + unzip Skia-${{ runner.os }}-Release-X64.zip -d skia + - name: Download Aseprite release + run: | + curl -o Aseprite-source.zip -L ${{ needs.check-version.outputs.download_url }} + unzip Aseprite-source.zip -d aseprite + mkdir -p aseprite/build + - name: (Windows) Set architecture for the produced binary + if: matrix.os == 'windows-latest' + shell: cmd + run: call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=x64 + - name: (Windows) Setting Visual Studio build environment variables and paths + if: matrix.os == 'windows-latest' + uses: seanmiddleditch/gha-setup-vsdevenv@v1 + - name: (Windows) Run CMake + if: matrix.os == 'windows-latest' + working-directory: aseprite/build + shell: cmd + run: cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_IGNORE_PATH='C:/ProgramData/chocolatey/bin/;C:/Strawberry/c/bin/' -DLAF_BACKEND=skia -DSKIA_DIR=../../skia -DSKIA_LIBRARY_DIR=../../skia/out/Release-x64 -G Ninja .. + - name: (Ubuntu) Run CMake + if: matrix.os == 'ubuntu-latest' + working-directory: aseprite/build + run: cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DLAF_BACKEND=skia -DSKIA_DIR=../../skia -DSKIA_LIBRARY_DIR=../../skia/out/Release-x64 -G Ninja .. + - name: (macOS) Run CMake + if: matrix.os == 'macOS-latest' + working-directory: aseprite/build + run: cmake -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -DLAF_BACKEND=skia -DSKIA_DIR=../../skia -DSKIA_LIBRARY_DIR=../../skia/out/Release-x64 -G Ninja .. + - name: Run Ninja + working-directory: aseprite/build + run: ninja aseprite + - name: Clean up build + working-directory: aseprite/build/bin + shell: bash + run: rm -f gen modp_b64_gen gen.exe gen.exe.manifest modp_b64_gen.exe modp_b64_gen.exe.manifest + - name: (Windows) Make portable zip + working-directory: aseprite/build/bin + run: echo '# This file is here so Aseprite behaves as a portable program' > aseprite.ini + - name: Create release + working-directory: aseprite/build/bin + run: 7z -tzip a Aseprite-${{ needs.check-version.outputs.latest_tag }}-${{ runner.os }}.zip * + - name: Upload release + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.check-version.outputs.upload_url }} + asset_path: aseprite/build/bin/Aseprite-${{ needs.check-version.outputs.latest_tag }}-${{ runner.os }}.zip + asset_name: Aseprite-${{ needs.check-version.outputs.latest_tag }}-${{ runner.os }}.zip + asset_content_type: application/zip diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..e9af98ed --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,224 @@ +yaml +name: Build and deploy Aseprite + +on: + schedule: + - cron: '0 0 * * *' # Ежедневно в полночь + push: + branches: + - master + +env: + BUILD_TYPE: Release + +jobs: + check-version: + name: Check latest Aseprite release + runs-on: ubuntu-latest + outputs: + download_url: ${{ steps.version_info.outputs.download_url }} + latest_tag: ${{ steps.version_info.outputs.latest_tag }} + should_build: ${{ steps.should_build.outputs.should_build }} + upload_url: ${{ steps.create_release.outputs.upload_url }} + steps: + - name: Get latest version info + id: version_info + run: | + # Получаем информацию о последнем релизе + response=$(curl -sL \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/aseprite/aseprite/releases/latest) + + # Извлекаем tag_name + latest_tag=$(echo "$response" | jq -r '.tag_name') + echo "Latest tag: $latest_tag" + + # Находим URL для скачивания исходного кода (обычно заканчивается на -Source.zip) + download_url=$(echo "$response" | jq -r '.assets[] | select(.name | test("-Source.zip$")) | .browser_download_url') + + if [ -z "$download_url" ]; then + echo "Error: Could not find source download URL" + exit 1 + fi + + echo "Download URL: $download_url" + + # Сохраняем tag для сравнения + echo "$latest_tag" > latest_tag.txt + + # Устанавливаем outputs + echo "::set-output name=latest_tag::$latest_tag" + echo "::set-output name=download_url::$download_url" + + - name: Check if version changed + id: check_version + run: | + # Читаем предыдущую версию из кэша (если есть) + if [ -f "cached_tag.txt" ]; then + cached_tag=$(cat cached_tag.txt) + echo "Cached version: $cached_tag" + else + cached_tag="" + echo "No cached version found" + fi + + current_tag=$(cat latest_tag.txt) + echo "Current version: $current_tag" + + # Проверяем, изменилась ли версия + if [ "$cached_tag" != "$current_tag" ]; then + echo "Version changed or first run, should build" + echo "::set-output name=should_build::true" + else + echo "Version unchanged, skip build" + echo "::set-output name=should_build::false" + fi + + - name: Cache version for next run + if: steps.check_version.outputs.should_build == 'true' + uses: actions/cache/save@v3 + with: + path: latest_tag.txt + key: aseprite-version-${{ steps.version_info.outputs.latest_tag }} + + - name: Create GitHub Release + id: create_release + if: steps.check_version.outputs.should_build == 'true' + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ steps.version_info.outputs.latest_tag }} + name: "Aseprite ${{ steps.version_info.outputs.latest_tag }}" + draft: true + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build-aseprite: + name: Build Aseprite + needs: check-version + if: ${{ needs.check-version.outputs.should_build == 'true' }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + fail-fast: false + steps: + - name: Install build dependencies (Ubuntu) + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install -y \ + cmake \ + ninja-build \ + libxcursor-dev \ + libxi-dev \ + libgl1-mesa-dev \ + libfontconfig1-dev \ + 7zip + + - name: Install build dependencies (Windows) + if: matrix.os == 'windows-latest' + shell: cmd + run: | + choco install -y cmake ninja 7zip + + - name: Install build dependencies (macOS) + if: matrix.os == 'macos-latest' + run: | + brew install cmake ninja p7zip + + - name: Download and extract Aseprite source + run: | + echo "Downloading Aseprite source..." + curl -L "${{ needs.check-version.outputs.download_url }}" -o aseprite-source.zip + + # Создаем директорию и распаковываем + mkdir -p aseprite + 7z x aseprite-source.zip -oaseprite + + # Переходим в правильную директорию (структура может отличаться) + if [ -d "aseprite/aseprite" ]; then + mv aseprite/aseprite/* aseprite/ + rm -rf aseprite/aseprite + fi + + ls -la aseprite/ + + - name: Download Skia + run: | + # Скачиваем Skia для соответствующей ОС + SKIA_URL="" + case "${{ matrix.os }}" in + windows-latest) + SKIA_URL="https://github.com/aseprite/skia/releases/download/m102-b858b2a2d6/Skia-Windows-Release-x64-libcxx.zip" + ;; + ubuntu-latest) + SKIA_URL="https://github.com/aseprite/skia/releases/download/m102-b858b2a2d6/Skia-Linux-Release-x64-libcxx.zip" + ;; + macos-latest) + SKIA_URL="https://github.com/aseprite/skia/releases/download/m102-b858b2a2d6/Skia-macOS-Release-x64-libcxx.zip" + ;; + esac + + echo "Downloading Skia from: $SKIA_URL" + curl -L "$SKIA_URL" -o skia.zip + mkdir -p skia + 7z x skia.zip -oskia + + - name: Configure with CMake + run: | + mkdir -p aseprite/build + cd aseprite/build + + CMAKE_ARGS="-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DLAF_BACKEND=skia -DSKIA_DIR=../../skia -DSKIA_LIBRARY_DIR=../../skia/out/Release-x64 -G Ninja" + + case "${{ matrix.os }}" in + windows-latest) + cmake $CMAKE_ARGS .. + ;; + ubuntu-latest) + cmake $CMAKE_ARGS .. + ;; + macos-latest) + # Для macOS нужно указать минимальную версию + cmake $CMAKE_ARGS \ + -DCMAKE_OSX_ARCHITECTURES=x86_64 \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 \ + .. + ;; + esac + + - name: Build with Ninja + run: | + cd aseprite/build + ninja aseprite + + - name: Prepare package + run: | + cd aseprite/build + + case "${{ matrix.os }}" in + windows-latest) + # Для Windows создаем portable версию + echo "; Portable configuration" > bin/aseprite.ini + 7z a -tzip "Aseprite-${{ needs.check-version.outputs.latest_tag }}-Windows.zip" bin/* + ;; + ubuntu-latest) + # Для Linux можно собрать AppImage или просто архив + 7z a -tzip "Aseprite-${{ needs.check-version.outputs.latest_tag }}-Linux.zip" bin/* + ;; + macos-latest) + # Для macOS создаем .dmg или .app bundle + # Упрощенный вариант - просто zip + 7z a -tzip "Aseprite-${{ needs.check-version.outputs.latest_tag }}-macOS.zip" bin/* + ;; + esac + + - name: Upload to GitHub Release + uses: softprops/action-gh-release@v1 + with: + files: | + aseprite/build/*.zip + tag_name: ${{ needs.check-version.outputs.latest_tag }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test_top b/.github/workflows/test_top new file mode 100644 index 00000000..2b2fd18d --- /dev/null +++ b/.github/workflows/test_top @@ -0,0 +1,270 @@ +name: Build and deploy Aseprite + +on: + schedule: + - cron: '0 0 * * *' # Ежедневно в полночь + push: + branches: + - main + workflow_dispatch: # Ручной запуск + +env: + BUILD_TYPE: Release + +jobs: + check-version: + name: Check latest Aseprite release + runs-on: ubuntu-latest + outputs: + download_url: ${{ steps.version_info.outputs.download_url }} + latest_tag: ${{ steps.version_info.outputs.latest_tag }} + should_build: ${{ steps.should_build.outputs.should_build }} + upload_url: ${{ steps.create_release.outputs.upload_url }} + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Get latest version info + id: version_info + run: | + # Получаем последний релиз Aseprite + response=$(curl -sL \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/aseprite/aseprite/releases/latest) + + # Извлекаем информацию + latest_tag=$(echo "$response" | jq -r '.tag_name') + echo "latest_tag=$latest_tag" >> $GITHUB_OUTPUT + echo "Latest tag: $latest_tag" + + # Находим source download URL + download_url=$(echo "$response" | jq -r '.assets[] | select(.name | contains("Source")) | .browser_download_url' | head -1) + + if [ -z "$download_url" ]; then + # Fallback: если не нашли Source, берем первый zip + download_url=$(echo "$response" | jq -r '.assets[0].browser_download_url') + fi + + echo "download_url=$download_url" >> $GITHUB_OUTPUT + echo "Download URL: $download_url" + + # Сохраняем tag в файл для кэширования + echo "$latest_tag" > latest_tag.txt + + - name: Cache version info + id: cache-version + uses: actions/cache@v3 + with: + path: latest_tag.txt + key: aseprite-version-${{ steps.version_info.outputs.latest_tag }} + + - name: Determine if build is needed + id: should_build + run: | + if [[ "${{ steps.cache-version.outputs.cache-hit }}" != 'true' ]]; then + echo "should_build=true" >> $GITHUB_OUTPUT + echo "New version detected, will build" + else + echo "should_build=false" >> $GITHUB_OUTPUT + echo "Version already built, skipping" + fi + + - name: Create GitHub Release draft + if: steps.should_build.outputs.should_build == 'true' + id: create_release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ steps.version_info.outputs.latest_tag }} + name: "Aseprite ${{ steps.version_info.outputs.latest_tag }}" + draft: true + prerelease: false + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + build-aseprite: + name: Build Aseprite + needs: check-version + if: ${{ needs.check-version.outputs.should_build == 'true' }} + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + fail-fast: false + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install system dependencies (Ubuntu) + if: matrix.os == 'ubuntu-latest' + run: | + sudo apt-get update + sudo apt-get install -y \ + build-essential \ + cmake \ + ninja-build \ + libxcursor-dev \ + libxi-dev \ + libgl1-mesa-dev \ + libfontconfig1-dev \ + libcurl4-openssl-dev \ + libpng-dev \ + libjpeg-dev \ + zlib1g-dev \ + 7zip + + - name: Install system dependencies (Windows) + if: matrix.os == 'windows-latest' + shell: pwsh + run: | + choco install -y cmake ninja 7zip + + - name: Install system dependencies (macOS) + if: matrix.os == 'macos-latest' + run: | + brew install cmake ninja p7zip + + - name: Download Aseprite source + run: | + echo "Downloading Aseprite source from: ${{ needs.check-version.outputs.download_url }}" + + # Создаем рабочие директории + mkdir -p aseprite-source aseprite + + # Скачиваем и распаковываем + curl -L "${{ needs.check-version.outputs.download_url }}" -o aseprite-source.zip + + if [[ "${{ matrix.os }}" == "windows-latest" ]]; then + 7z x aseprite-source.zip -oaseprite-source + else + unzip -q aseprite-source.zip -d aseprite-source + fi + + # Находим и копируем исходники + find aseprite-source -name "CMakeLists.txt" -type f | head -1 | xargs dirname | xargs -I {} cp -r {}/* aseprite/ 2>/dev/null || true + + # Fallback: если не нашли CMakeLists.txt + if [ ! -f "aseprite/CMakeLists.txt" ]; then + cp -r aseprite-source/*/* aseprite/ 2>/dev/null || cp -r aseprite-source/* aseprite/ + fi + + echo "Aseprite source structure:" + ls -la aseprite/ + + - name: Download Skia + run: | + # Определяем URL для Skia в зависимости от ОС + case "${{ matrix.os }}" in + ubuntu-latest) + SKIA_URL="https://github.com/aseprite/skia/releases/latest/download/Skia-Linux-Release-x64-libcxx.zip" + ;; + windows-latest) + SKIA_URL="https://github.com/aseprite/skia/releases/latest/download/Skia-Windows-Release-x64-libcxx.zip" + ;; + macos-latest) + SKIA_URL="https://github.com/aseprite/skia/releases/latest/download/Skia-macOS-Release-x64-libcxx.zip" + ;; + esac + + echo "Downloading Skia from: $SKIA_URL" + mkdir -p skia + + curl -L "$SKIA_URL" -o skia.zip + + if [[ "${{ matrix.os }}" == "windows-latest" ]]; then + 7z x skia.zip -oskia + else + unzip -q skia.zip -d skia + fi + + echo "Skia downloaded successfully" + + - name: Cache Skia + uses: actions/cache@v3 + with: + path: skia + key: skia-${{ matrix.os }}-${{ hashFiles('skia/README.md') }} + restore-keys: | + skia-${{ matrix.os }}- + + - name: Configure with CMake + run: | + mkdir -p aseprite/build + cd aseprite/build + + # Базовые параметры CMake + CMAKE_ARGS="\ + -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} \ + -DLAF_BACKEND=skia \ + -DSKIA_DIR=../../skia \ + -DSKIA_LIBRARY_DIR=../../skia/out/Release-x64 \ + -G Ninja \ + .." + + # OS-specific параметры + case "${{ matrix.os }}" in + windows-latest) + cmake $CMAKE_ARGS + ;; + macos-latest) + cmake $CMAKE_ARGS \ + -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \ + -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 + ;; + *) + cmake $CMAKE_ARGS + ;; + esac + + echo "CMake configuration complete" + + - name: Build with Ninja + run: | + cd aseprite/build + ninja -j$(nproc) aseprite + + echo "Build completed successfully" + ls -la bin/ + + - name: Create portable package + run: | + cd aseprite/build/bin + + # Создаем портативный конфиг файл + echo "; Aseprite Portable Configuration" > aseprite.ini + echo "[general]" >> aseprite.ini + echo "autosave_timer = 300" >> aseprite.ini + + # Упаковываем в архив + case "${{ matrix.os }}" in + windows-latest) + 7z a -tzip "Aseprite-${{ needs.check-version.outputs.latest_tag }}-Windows-x64.zip" * + ;; + macos-latest) + zip -r "Aseprite-${{ needs.check-version.outputs.latest_tag }}-macOS.zip" * + ;; + *) + zip -r "Aseprite-${{ needs.check-version.outputs.latest_tag }}-Linux-x64.zip" * + ;; + esac + + echo "Package created:" + ls -la *.zip + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: aseprite-${{ matrix.os }}-${{ needs.check-version.outputs.latest_tag }} + path: aseprite/build/bin/*.zip + retention-days: 7 + + - name: Upload to GitHub Release + uses: softprops/action-gh-release@v1 + with: + files: aseprite/build/bin/*.zip + tag_name: ${{ needs.check-version.outputs.latest_tag }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}