From 32b5bf38aa5ef94c520d9012efbfe86b90015929 Mon Sep 17 00:00:00 2001 From: gronod Date: Tue, 25 Aug 2026 21:19:10 +0100 Subject: [PATCH] feat: Separate github and gitea CI/CD workflows --- .gitea/workflows/build-linux.yml | 139 ++++++++++++++++++++++++++++ .gitea/workflows/build-macos.yml | 115 +++++++++++++++++++++++ .gitea/workflows/build-windows.yml | 126 +++++++++++++++++++++++++ .github/workflows/build-linux.yml | 4 +- .github/workflows/build-windows.yml | 4 +- 5 files changed, 384 insertions(+), 4 deletions(-) create mode 100644 .gitea/workflows/build-linux.yml create mode 100644 .gitea/workflows/build-macos.yml create mode 100644 .gitea/workflows/build-windows.yml diff --git a/.gitea/workflows/build-linux.yml b/.gitea/workflows/build-linux.yml new file mode 100644 index 0000000..d21bda0 --- /dev/null +++ b/.gitea/workflows/build-linux.yml @@ -0,0 +1,139 @@ +name: Build Linux Packages + +on: + push: + branches: + - main + - development + tags: + - 'v*' + pull_request: + branches: + - main + - development + +jobs: + build-linux: + name: Build Linux + runs-on: ubuntu-latest + env: + APPIMAGE_EXTRACT_AND_RUN: 1 + NO_STRIP: "true" + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + targets: x86_64-unknown-linux-gnu + + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + continue-on-error: true + with: + workspaces: "src-tauri -> target" + + - name: Cache APT Packages + uses: actions/cache@v3 + with: + path: /var/cache/apt/archives + key: ${{ runner.os }}-apt-packages-v1 + restore-keys: | + ${{ runner.os }}-apt-packages- + + - name: Install Tauri Linux dependencies + run: | + sudo apt-get update -qq + sudo apt-get install --no-install-recommends -y \ + libwebkit2gtk-4.1-dev \ + build-essential \ + curl wget file patchelf xdg-utils squashfs-tools zsync \ + libayatana-appindicator3-dev \ + librsvg2-dev \ + libssl-dev \ + libxss-dev \ + libxinerama-dev \ + libxrandr-dev \ + libxxf86vm-dev \ + libxcursor-dev \ + libxi-dev + sudo apt-get install --no-install-recommends -y libfuse2 || sudo apt-get install --no-install-recommends -y libfuse2t64 || true + + - name: Install Node dependencies + run: npm ci + + - name: Get App Version + id: get_version + shell: bash + run: | + VERSION=$(node -p "require('./package.json').version") + if [[ "${{ github.ref }}" == refs/tags/* ]]; then + TAG="${{ github.ref_name }}" + echo "APP_VERSION=${TAG#v}" >> $GITHUB_ENV + echo "RELEASE_TAG=${TAG}" >> $GITHUB_ENV + elif [ "${{ github.ref }}" = "refs/heads/main" ]; then + echo "APP_VERSION=${VERSION}" >> $GITHUB_ENV + echo "RELEASE_TAG=v${VERSION}" >> $GITHUB_ENV + else + echo "APP_VERSION=${VERSION}-dev" >> $GITHUB_ENV + fi + + - name: Prepare platform-specific resources + run: | + echo "Removing Windows ArgyllCMS binaries to avoid bundling them in Linux packages..." + rm -rf src-tauri/argyll/windows-x86_64 + + - name: Build Tauri App + env: + APPIMAGE_EXTRACT_AND_RUN: 1 + NO_STRIP: "true" + run: npm run tauri build -- -v --bundles deb,appimage + + - name: Upload Debian Package + uses: actions/upload-artifact@v3 + with: + name: iccery-linux-deb-${{ env.APP_VERSION }} + path: src-tauri/target/release/bundle/deb/*.deb + + - name: Upload AppImage + uses: actions/upload-artifact@v3 + with: + name: iccery-linux-appimage-${{ env.APP_VERSION }} + path: src-tauri/target/release/bundle/appimage/*.AppImage + + - name: Upload Release Assets to Gitea + if: (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') && !cancelled() + env: + GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SERVER_URL: ${{ github.server_url }} + REPO: ${{ github.repository }} + run: | + set +e + echo "Finding release for tag ${RELEASE_TAG}..." + RELEASE_RESP=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" "${SERVER_URL}/api/v1/repos/${REPO}/releases/tags/${RELEASE_TAG}") + RELEASE_ID=$(echo "${RELEASE_RESP}" | grep -o '"id":[0-9]*' | head -n 1 | cut -d: -f2) + if [ -n "${RELEASE_ID}" ]; then + echo "Found Release ID: ${RELEASE_ID}. Uploading Linux assets..." + for f in src-tauri/target/release/bundle/deb/*.deb src-tauri/target/release/bundle/appimage/*.AppImage; do + if [ -f "$f" ]; then + FILENAME=$(basename "$f") + echo "Uploading $FILENAME to release ${RELEASE_ID}..." + curl -s -X POST \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -H "Content-Type: multipart/form-data" \ + -F "attachment=@$f" \ + "${SERVER_URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${FILENAME}" + fi + done + else + echo "No existing release found for tag ${RELEASE_TAG}. Skipping asset upload." + fi diff --git a/.gitea/workflows/build-macos.yml b/.gitea/workflows/build-macos.yml new file mode 100644 index 0000000..400b860 --- /dev/null +++ b/.gitea/workflows/build-macos.yml @@ -0,0 +1,115 @@ +name: Build macOS Packages + +on: + push: + branches: + - main + - development + tags: + - 'v*' + pull_request: + branches: + - main + - development + +jobs: + build-macos: + name: Build macOS (${{ matrix.platform.name }}) + runs-on: ${{ matrix.platform.os }} + strategy: + matrix: + platform: + - name: Intel + os: macos-13 + target: x86_64-apple-darwin + binary_dir: macos-x86_64 + - name: Apple Silicon + os: macos-14 + target: aarch64-apple-darwin + binary_dir: macos-aarch64 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install Rust stable + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + targets: ${{ matrix.platform.target }} + + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + + - name: Check sidecar binaries + run: | + if [ ! -d "src-tauri/argyll/${{ matrix.platform.binary_dir }}" ]; then + echo "Warning: macOS ArgyllCMS binaries not found. Please ensure they are downloaded/committed to src-tauri/argyll/${{ matrix.platform.binary_dir }} before release." + fi + + - name: Install Node dependencies + run: npm ci + + - name: Get App Version + id: get_version + shell: bash + run: | + VERSION=$(node -p "require('./package.json').version") + if [[ "${{ github.ref }}" == refs/tags/* ]]; then + TAG="${{ github.ref_name }}" + echo "APP_VERSION=${TAG#v}" >> $GITHUB_ENV + echo "RELEASE_TAG=${TAG}" >> $GITHUB_ENV + elif [ "${{ github.ref }}" = "refs/heads/main" ]; then + echo "APP_VERSION=${VERSION}" >> $GITHUB_ENV + echo "RELEASE_TAG=v${VERSION}" >> $GITHUB_ENV + else + echo "APP_VERSION=${VERSION}-dev" >> $GITHUB_ENV + fi + + - name: Build Tauri App + run: npm run tauri build + + - name: Upload DMG + uses: actions/upload-artifact@v3 + with: + name: iccery-macos-${{ matrix.platform.name }}-dmg-${{ env.APP_VERSION }} + path: src-tauri/target/release/bundle/dmg/*.dmg + + - name: Upload App Bundle + uses: actions/upload-artifact@v3 + with: + name: iccery-macos-${{ matrix.platform.name }}-app-${{ env.APP_VERSION }} + path: src-tauri/target/release/bundle/macos/*.app + + - name: Upload Release Assets to Gitea + if: (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') && !cancelled() + env: + GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SERVER_URL: ${{ github.server_url }} + REPO: ${{ github.repository }} + run: | + echo "Finding release for tag ${RELEASE_TAG}..." + RELEASE_RESP=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" "${SERVER_URL}/api/v1/repos/${REPO}/releases/tags/${RELEASE_TAG}") + RELEASE_ID=$(echo "${RELEASE_RESP}" | grep -o '"id":[0-9]*' | head -n 1 | cut -d: -f2) + if [ -n "${RELEASE_ID}" ]; then + echo "Found Release ID: ${RELEASE_ID}. Uploading macOS assets..." + for f in src-tauri/target/release/bundle/dmg/*.dmg src-tauri/target/release/bundle/macos/*.app; do + if [ -e "$f" ]; then + FILENAME=$(basename "$f") + echo "Uploading $FILENAME to release ${RELEASE_ID}..." + curl -s -X POST \ + -H "Authorization: token ${GITEA_TOKEN}" \ + -H "Content-Type: multipart/form-data" \ + -F "attachment=@$f" \ + "${SERVER_URL}/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets?name=${FILENAME}" + fi + done + else + echo "No existing release found for tag ${RELEASE_TAG}. Skipping asset upload." + fi diff --git a/.gitea/workflows/build-windows.yml b/.gitea/workflows/build-windows.yml new file mode 100644 index 0000000..144a175 --- /dev/null +++ b/.gitea/workflows/build-windows.yml @@ -0,0 +1,126 @@ +name: Build Windows Packages + +on: + push: + branches: + - main + - development + tags: + - 'v*' + pull_request: + branches: + - main + - development + +jobs: + build-windows: + name: Build Windows + runs-on: windows + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'npm' + + - name: Install Rust stable + shell: powershell + run: | + if (!(Get-Command rustup -ErrorAction SilentlyContinue) -and !(Test-Path "$env:USERPROFILE\.cargo\bin\rustup.exe")) { + Write-Host "Downloading rustup-init.exe..." + Invoke-WebRequest -Uri "https://win.rustup.rs/x86_64" -OutFile "$env:TEMP\rustup-init.exe" + & "$env:TEMP\rustup-init.exe" -y --default-toolchain stable --profile minimal + } + "$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + rustup default stable + rustup target add x86_64-pc-windows-msvc + + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + continue-on-error: true + with: + workspaces: "src-tauri -> target" + + - name: Check sidecar binaries + shell: powershell + run: | + if (!(Test-Path "src-tauri\argyll\windows-x86_64\argyll-instlist.exe")) { + Write-Host "Warning: Windows ArgyllCMS binaries not found. Please ensure they are downloaded/committed to src-tauri/argyll/windows-x86_64 before release." + } + + - name: Install Node dependencies + run: npm ci + + - name: Get App Version + id: get_version + shell: powershell + run: | + $VERSION = node -p "require('./package.json').version" + if ($env:GITHUB_REF -like "refs/tags/*") { + $TAG = $env:GITHUB_REF_NAME + "APP_VERSION=$($TAG.TrimStart('v'))" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + "RELEASE_TAG=$TAG" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } elseif ($env:GITHUB_REF -eq "refs/heads/main") { + "APP_VERSION=$VERSION" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + "RELEASE_TAG=v$VERSION" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } else { + "APP_VERSION=$VERSION-dev" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } + + - name: Prepare platform-specific resources + shell: powershell + run: | + if (Test-Path "src-tauri\argyll\linux-x86_64") { + Write-Host "Removing Linux ArgyllCMS binaries to avoid bundling them in Windows installer..." + Remove-Item -Recurse -Force "src-tauri\argyll\linux-x86_64" + } + + - name: Build Tauri App + run: npm run tauri build -- -v + + - name: Upload MSI Installer + uses: actions/upload-artifact@v3 + with: + name: iccery-windows-msi-${{ env.APP_VERSION }} + path: src-tauri/target/release/bundle/msi/*.msi + + - name: Upload NSIS Installer + uses: actions/upload-artifact@v3 + with: + name: iccery-windows-exe-${{ env.APP_VERSION }} + path: src-tauri/target/release/bundle/nsis/*.exe + + - name: Upload Release Assets to Gitea + if: (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') && !cancelled() + shell: powershell + env: + GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SERVER_URL: ${{ github.server_url }} + REPO: ${{ github.repository }} + run: | + $TAG = $env:RELEASE_TAG + if (-not $TAG) { $TAG = "v$env:APP_VERSION" } + Write-Host "Finding release for tag $TAG..." + $headers = @{ "Authorization" = "token $env:GITEA_TOKEN" } + try { + $release = Invoke-RestMethod -Uri "$env:SERVER_URL/api/v1/repos/$env:REPO/releases/tags/$TAG" -Headers $headers -Method Get + $releaseId = $release.id + if ($releaseId) { + Write-Host "Found Release ID: $releaseId. Uploading Windows assets..." + $files = Get-ChildItem -Path "src-tauri\target\release\bundle\msi\*.msi", "src-tauri\target\release\bundle\nsis\*.exe" -ErrorAction SilentlyContinue + foreach ($file in $files) { + Write-Host "Uploading $($file.Name)..." + curl.exe -s -X POST ` + -H "Authorization: token $env:GITEA_TOKEN" ` + -H "Content-Type: multipart/form-data" ` + -F "attachment=@$($file.FullName)" ` + "$env:SERVER_URL/api/v1/repos/$env:REPO/releases/$releaseId/assets?name=$($file.Name)" + } + } + } catch { + Write-Host "Skipping release asset upload: $_" + } diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index d21bda0..be0532e 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -99,13 +99,13 @@ jobs: run: npm run tauri build -- -v --bundles deb,appimage - name: Upload Debian Package - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: iccery-linux-deb-${{ env.APP_VERSION }} path: src-tauri/target/release/bundle/deb/*.deb - name: Upload AppImage - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: iccery-linux-appimage-${{ env.APP_VERSION }} path: src-tauri/target/release/bundle/appimage/*.AppImage diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 144a175..2f3bb0f 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -83,13 +83,13 @@ jobs: run: npm run tauri build -- -v - name: Upload MSI Installer - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: iccery-windows-msi-${{ env.APP_VERSION }} path: src-tauri/target/release/bundle/msi/*.msi - name: Upload NSIS Installer - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: iccery-windows-exe-${{ env.APP_VERSION }} path: src-tauri/target/release/bundle/nsis/*.exe -- 2.39.5