Add Gitea Actions workflows for CI and NuGet release
This commit is contained in:
parent
afbf8f6782
commit
0dd7a2d3fb
|
|
@ -0,0 +1,39 @@
|
|||
# OpenMaui Linux CI/CD Pipeline for Gitea
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main, develop]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
DOTNET_NOLOGO: true
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and Test
|
||||
runs-on: windows
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- 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 (preview)
|
||||
run: dotnet pack --configuration Release --no-build -o ./nupkg
|
||||
|
||||
- name: Upload NuGet artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: nuget-package
|
||||
path: ./nupkg/*.nupkg
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
# OpenMaui Linux Release - Publish to NuGet
|
||||
name: Release to NuGet
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
env:
|
||||
DOTNET_NOLOGO: true
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT: true
|
||||
|
||||
jobs:
|
||||
release:
|
||||
name: Build and Publish to NuGet
|
||||
runs-on: windows
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Extract version from tag
|
||||
id: version
|
||||
shell: pwsh
|
||||
run: |
|
||||
$tag = "${{ github.ref_name }}"
|
||||
$version = $tag -replace '^v', ''
|
||||
echo "VERSION=$version" >> $env:GITHUB_OUTPUT
|
||||
echo "Building version: $version"
|
||||
|
||||
- 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
|
||||
|
||||
- name: Pack NuGet package
|
||||
run: dotnet pack --configuration Release --no-build -o ./nupkg /p:PackageVersion=${{ steps.version.outputs.VERSION }}
|
||||
|
||||
- name: Publish to NuGet.org
|
||||
run: dotnet nuget push ./nupkg/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate
|
||||
Loading…
Reference in New Issue