mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-07-09 10:37:04 +00:00
68 lines
1.9 KiB
YAML
68 lines
1.9 KiB
YAML
name: NuGet Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'master'
|
|
- 'release'
|
|
tags:
|
|
- '[0-9]+.[0-9]+.[0-9]+'
|
|
pull_request:
|
|
branches:
|
|
- 'master'
|
|
- 'release'
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build-and-publish:
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [windows-latest, ubuntu-latest]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0 # Fetch all history for versioning
|
|
|
|
- uses: actions/setup-dotnet@v5
|
|
with:
|
|
global-json-file: global.json
|
|
|
|
# Determine version using C# build target
|
|
- name: Determine Version
|
|
id: version
|
|
run: dotnet run --project build/build.csproj -- determine-version
|
|
|
|
# Update version in project file using C# build target
|
|
- name: Update Version in Project
|
|
run: dotnet run --project build/build.csproj -- update-version
|
|
env:
|
|
VERSION: ${{ steps.version.outputs.version }}
|
|
|
|
# Build and test
|
|
- name: Build and Test
|
|
run: dotnet run --project build/build.csproj
|
|
|
|
- name: Validate AOT Smoke Test
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: |
|
|
dotnet publish tests/SharpCompress.AotSmoke/SharpCompress.AotSmoke.csproj --configuration Release --runtime linux-x64 --self-contained true --output artifacts/aot-smoke
|
|
./artifacts/aot-smoke/SharpCompress.AotSmoke
|
|
|
|
# Upload artifacts for verification
|
|
- name: Upload NuGet Package
|
|
uses: actions/upload-artifact@v7
|
|
with:
|
|
name: ${{ matrix.os }}-nuget-package
|
|
path: artifacts/*.nupkg
|
|
|
|
# Push to NuGet.org only for version tag pushes (Windows only)
|
|
- name: Push to NuGet
|
|
if: success() && matrix.os == 'windows-latest' && startsWith(github.ref, 'refs/tags/')
|
|
run: dotnet run --project build/build.csproj -- push-to-nuget
|
|
env:
|
|
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
|