diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 5710f6b..b0a8e47 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -1,46 +1,91 @@ -# OpenMaui Linux CI/CD Pipeline for Gitea +# OpenMaui Linux CI Pipeline name: CI on: push: - branches: [main, develop] + branches: [main, final, develop] pull_request: branches: [main] env: DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true - DOTNET_ROOT: C:\dotnet jobs: - build: - name: Build and Test - runs-on: windows + build-linux: + name: Build (Linux) + runs-on: linux-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v3 - name: Restore dependencies - run: C:\dotnet\dotnet.exe restore + run: dotnet restore - name: Build - run: C:\dotnet\dotnet.exe build --configuration Release --no-restore + run: dotnet build --configuration Release --no-restore - name: Run tests - run: C:\dotnet\dotnet.exe test --configuration Release --no-build --verbosity normal + run: dotnet test --configuration Release --no-build --verbosity normal continue-on-error: true - - name: Pack NuGet (preview) - run: C:\dotnet\dotnet.exe pack --configuration Release --no-build -o ./nupkg + - name: Pack NuGet + run: dotnet pack --configuration Release --no-build -o ./nupkg - - name: List NuGet packages - run: dir .\nupkg\ + - name: Upload NuGet packages + uses: actions/upload-artifact@v3 + with: + name: nuget-packages-linux + path: ./nupkg/*.nupkg - - name: Push to NuGet.org - if: github.ref == 'refs/heads/main' && github.event_name == 'push' - run: | - foreach ($pkg in (Get-ChildItem .\nupkg\*.nupkg)) { - C:\dotnet\dotnet.exe nuget push $pkg.FullName --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate - } - env: - NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + build-windows: + name: Build (Windows) + runs-on: windows-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Run tests + run: dotnet test --configuration Release --no-build --verbosity normal + continue-on-error: true + + - name: Pack NuGet + run: dotnet pack --configuration Release --no-build -o ./nupkg + + - name: Upload NuGet packages + uses: actions/upload-artifact@v3 + with: + name: nuget-packages-windows + path: ./nupkg/*.nupkg + + build-macos: + name: Build (macOS) + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --configuration Release --no-restore + + - name: Run tests + run: dotnet test --configuration Release --no-build --verbosity normal + continue-on-error: true + + - name: Pack NuGet + run: dotnet pack --configuration Release --no-build -o ./nupkg + + - name: Upload NuGet packages + uses: actions/upload-artifact@v3 + with: + name: nuget-packages-macos + path: ./nupkg/*.nupkg diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 7081e41..b7c47e4 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -1,5 +1,5 @@ -# OpenMaui Linux Release - Publish to NuGet -name: Release to NuGet +# OpenMaui Linux Release - Publish to Package Registries +name: Release on: release: @@ -11,31 +11,58 @@ on: env: DOTNET_NOLOGO: true DOTNET_CLI_TELEMETRY_OPTOUT: true - DOTNET_ROOT: C:\dotnet jobs: release: - name: Build and Publish to NuGet - runs-on: windows + name: Build and Publish + runs-on: linux-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v3 + + - name: Get version from tag + id: version + run: | + VERSION=${GITHUB_REF#refs/tags/v} + echo "VERSION=$VERSION" >> $GITHUB_OUTPUT + echo "Building version: $VERSION" - name: Restore dependencies - run: C:\dotnet\dotnet.exe restore + run: dotnet restore - name: Build - run: C:\dotnet\dotnet.exe build --configuration Release --no-restore + run: dotnet build --configuration Release --no-restore - name: Run tests - run: C:\dotnet\dotnet.exe test --configuration Release --no-build --verbosity normal + run: dotnet test --configuration Release --no-build --verbosity normal continue-on-error: true - name: Pack NuGet package - run: C:\dotnet\dotnet.exe pack --configuration Release --no-build -o ./nupkg + run: dotnet pack --configuration Release --no-build -o ./nupkg -p:PackageVersion=${{ steps.version.outputs.VERSION }} + + - name: Upload NuGet packages + uses: actions/upload-artifact@v3 + with: + name: nuget-packages + path: ./nupkg/*.nupkg + + - name: Publish to Gitea Packages + run: | + for pkg in ./nupkg/*.nupkg; do + dotnet nuget push "$pkg" \ + --api-key ${{ secrets.GITHUB_TOKEN }} \ + --source https://git.marketally.com/api/packages/${{ github.repository_owner }}/nuget/index.json \ + --skip-duplicate + done - name: Publish to NuGet.org + if: ${{ secrets.NUGET_API_KEY != '' }} run: | - foreach ($pkg in (Get-ChildItem .\nupkg\*.nupkg)) { - C:\dotnet\dotnet.exe nuget push $pkg.FullName --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate - } + for pkg in ./nupkg/*.nupkg; do + dotnet nuget push "$pkg" \ + --api-key ${{ secrets.NUGET_API_KEY }} \ + --source https://api.nuget.org/v3/index.json \ + --skip-duplicate + done + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}