Workflows set
This commit is contained in:
@@ -1,46 +1,91 @@
|
|||||||
# OpenMaui Linux CI/CD Pipeline for Gitea
|
# OpenMaui Linux CI Pipeline
|
||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main, develop]
|
branches: [main, final, develop]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOTNET_NOLOGO: true
|
DOTNET_NOLOGO: true
|
||||||
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
||||||
DOTNET_ROOT: C:\dotnet
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-linux:
|
||||||
name: Build and Test
|
name: Build (Linux)
|
||||||
runs-on: windows
|
runs-on: linux-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Restore dependencies
|
- name: Restore dependencies
|
||||||
run: C:\dotnet\dotnet.exe restore
|
run: dotnet restore
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: C:\dotnet\dotnet.exe build --configuration Release --no-restore
|
run: dotnet build --configuration Release --no-restore
|
||||||
|
|
||||||
- name: Run tests
|
- 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
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Pack NuGet (preview)
|
- name: Pack NuGet
|
||||||
run: C:\dotnet\dotnet.exe pack --configuration Release --no-build -o ./nupkg
|
run: dotnet pack --configuration Release --no-build -o ./nupkg
|
||||||
|
|
||||||
- name: List NuGet packages
|
- name: Upload NuGet packages
|
||||||
run: dir .\nupkg\
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: nuget-packages-linux
|
||||||
|
path: ./nupkg/*.nupkg
|
||||||
|
|
||||||
- name: Push to NuGet.org
|
build-windows:
|
||||||
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
name: Build (Windows)
|
||||||
run: |
|
runs-on: windows-latest
|
||||||
foreach ($pkg in (Get-ChildItem .\nupkg\*.nupkg)) {
|
steps:
|
||||||
C:\dotnet\dotnet.exe nuget push $pkg.FullName --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
|
- name: Checkout
|
||||||
}
|
uses: actions/checkout@v3
|
||||||
env:
|
|
||||||
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
|
- 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
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
# OpenMaui Linux Release - Publish to NuGet
|
# OpenMaui Linux Release - Publish to Package Registries
|
||||||
name: Release to NuGet
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
@@ -11,31 +11,58 @@ on:
|
|||||||
env:
|
env:
|
||||||
DOTNET_NOLOGO: true
|
DOTNET_NOLOGO: true
|
||||||
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
||||||
DOTNET_ROOT: C:\dotnet
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
name: Build and Publish to NuGet
|
name: Build and Publish
|
||||||
runs-on: windows
|
runs-on: linux-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- 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
|
- name: Restore dependencies
|
||||||
run: C:\dotnet\dotnet.exe restore
|
run: dotnet restore
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: C:\dotnet\dotnet.exe build --configuration Release --no-restore
|
run: dotnet build --configuration Release --no-restore
|
||||||
|
|
||||||
- name: Run tests
|
- 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
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Pack NuGet package
|
- 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
|
- name: Publish to NuGet.org
|
||||||
|
if: ${{ secrets.NUGET_API_KEY != '' }}
|
||||||
run: |
|
run: |
|
||||||
foreach ($pkg in (Get-ChildItem .\nupkg\*.nupkg)) {
|
for pkg in ./nupkg/*.nupkg; do
|
||||||
C:\dotnet\dotnet.exe nuget push $pkg.FullName --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
|
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 }}
|
||||||
|
|||||||
Reference in New Issue
Block a user