From 73ee0b2bb3c966cbfb116703db4636af79f46185 Mon Sep 17 00:00:00 2001 From: logikonline Date: Sat, 24 Jan 2026 07:54:02 +0000 Subject: [PATCH] workflows set --- .gitea/workflows/ci.yml | 72 ++++++++++++++++ .gitea/workflows/release.yml | 155 +++++++++++++++++++++++++++++++++++ 2 files changed, 227 insertions(+) create mode 100644 .gitea/workflows/ci.yml create mode 100644 .gitea/workflows/release.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..a541e7f --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,72 @@ +# OpenMaui Linux Samples CI +name: CI + +on: + push: + branches: [main, develop] + pull_request: + branches: [main] + +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + +jobs: + build-linux-x64: + name: Build Samples (Linux x64) + runs-on: linux-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Restore dependencies + run: dotnet restore + + - name: Build ShellDemo + run: dotnet build ShellDemo/ShellDemo.csproj --configuration Release + + - name: Build TodoApp + run: dotnet build TodoApp/TodoApp.csproj --configuration Release + + - name: Build WebViewDemo + run: dotnet build WebViewDemo/WebViewDemo.csproj --configuration Release + + build-linux-arm64: + name: Build Samples (Linux arm64) + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Build in Docker (arm64) + run: | + docker run --rm --platform linux/arm64 \ + -v "$PWD:/src" -w /src \ + mcr.microsoft.com/dotnet/sdk:9.0 \ + bash -c "dotnet restore && dotnet build --configuration Release" + + build-windows: + name: Build Samples (Windows) + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Restore dependencies + run: dotnet restore + + - name: Build all samples + run: dotnet build --configuration Release + + build-macos: + name: Build Samples (macOS) + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Restore dependencies + run: dotnet restore + + - name: Build all samples + run: dotnet build --configuration Release diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml new file mode 100644 index 0000000..7d91734 --- /dev/null +++ b/.gitea/workflows/release.yml @@ -0,0 +1,155 @@ +# OpenMaui Linux Samples Release - Build AppImages +name: Release + +on: + release: + types: [published] + push: + tags: + - 'v*' + +env: + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + GITEA_PACKAGES_URL: https://git.marketally.com/api/packages/AuroraOSS/nuget/index.json + +jobs: + build-appimages-x64: + name: Build AppImages (Linux x64) + runs-on: linux-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install appimagetool + run: | + wget -q https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O /tmp/appimagetool + chmod +x /tmp/appimagetool + sudo mv /tmp/appimagetool /usr/local/bin/appimagetool + + - name: Add Gitea NuGet source + run: | + dotnet nuget add source "$GITEA_PACKAGES_URL" --name gitea || true + + - name: Install OpenMaui.AppImage tool + run: | + dotnet tool install --global OpenMaui.AppImage || \ + dotnet tool install --global OpenMaui.AppImage --add-source "$GITEA_PACKAGES_URL" || \ + dotnet tool update --global OpenMaui.AppImage + + - name: Publish ShellDemo + run: dotnet publish ShellDemo/ShellDemo.csproj -c Release -r linux-x64 --self-contained -o ./publish/ShellDemo + + - name: Publish TodoApp + run: dotnet publish TodoApp/TodoApp.csproj -c Release -r linux-x64 --self-contained -o ./publish/TodoApp + + - name: Publish WebViewDemo + run: dotnet publish WebViewDemo/WebViewDemo.csproj -c Release -r linux-x64 --self-contained -o ./publish/WebViewDemo + + - name: Create ShellDemo AppImage + run: | + mkdir -p ./appimages + ~/.dotnet/tools/openmaui-appimage \ + -i ./publish/ShellDemo \ + -o ./appimages/ShellDemo-x64.AppImage \ + -n "Shell Demo" + + - name: Create TodoApp AppImage + run: | + ~/.dotnet/tools/openmaui-appimage \ + -i ./publish/TodoApp \ + -o ./appimages/TodoApp-x64.AppImage \ + -n "Todo App" + + - name: Create WebViewDemo AppImage + run: | + ~/.dotnet/tools/openmaui-appimage \ + -i ./publish/WebViewDemo \ + -o ./appimages/WebViewDemo-x64.AppImage \ + -n "WebView Demo" + + - name: Upload AppImages + uses: actions/upload-artifact@v3 + with: + name: appimages-x64 + path: ./appimages/*.AppImage + + build-appimages-arm64: + name: Build AppImages (Linux arm64) + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Build and package in Docker (arm64) + run: | + mkdir -p ./appimages + + docker run --rm --platform linux/arm64 \ + -v "$PWD:/src" -w /src \ + -e GITEA_PACKAGES_URL="$GITEA_PACKAGES_URL" \ + mcr.microsoft.com/dotnet/sdk:9.0 \ + bash -c " + set -e + + # Install appimagetool + apt-get update && apt-get install -y wget file + wget -q https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-aarch64.AppImage -O /tmp/appimagetool + chmod +x /tmp/appimagetool + mv /tmp/appimagetool /usr/local/bin/appimagetool + + # Add Gitea source and install tool + dotnet nuget add source \"\$GITEA_PACKAGES_URL\" --name gitea || true + dotnet tool install --global OpenMaui.AppImage || \ + dotnet tool install --global OpenMaui.AppImage --add-source \"\$GITEA_PACKAGES_URL\" || true + export PATH=\"\$PATH:/root/.dotnet/tools\" + + # Publish samples + dotnet publish ShellDemo/ShellDemo.csproj -c Release -r linux-arm64 --self-contained -o ./publish/ShellDemo + dotnet publish TodoApp/TodoApp.csproj -c Release -r linux-arm64 --self-contained -o ./publish/TodoApp + dotnet publish WebViewDemo/WebViewDemo.csproj -c Release -r linux-arm64 --self-contained -o ./publish/WebViewDemo + + # Create AppImages + mkdir -p ./appimages + openmaui-appimage -i ./publish/ShellDemo -o ./appimages/ShellDemo-arm64.AppImage -n 'Shell Demo' + openmaui-appimage -i ./publish/TodoApp -o ./appimages/TodoApp-arm64.AppImage -n 'Todo App' + openmaui-appimage -i ./publish/WebViewDemo -o ./appimages/WebViewDemo-arm64.AppImage -n 'WebView Demo' + " + + - name: Upload AppImages + uses: actions/upload-artifact@v3 + with: + name: appimages-arm64 + path: ./appimages/*.AppImage + + create-release: + name: Attach to Release + needs: [build-appimages-x64, build-appimages-arm64] + runs-on: linux-latest + if: github.event_name == 'release' + steps: + - name: Download x64 AppImages + uses: actions/download-artifact@v3 + with: + name: appimages-x64 + path: ./release + + - name: Download arm64 AppImages + uses: actions/download-artifact@v3 + with: + name: appimages-arm64 + path: ./release + + - name: List release files + run: ls -la ./release/ + + - name: Upload to Gitea Release + run: | + for file in ./release/*.AppImage; do + filename=$(basename "$file") + curl -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Content-Type: application/octet-stream" \ + --data-binary @"$file" \ + "https://git.marketally.com/api/v1/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets?name=$filename" + done