60 lines
2.2 KiB
YAML
60 lines
2.2 KiB
YAML
name: Release
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
jobs:
|
|
release:
|
|
name: Version, Build, and Release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: 10.0.x
|
|
- name: Setup PowerShell LTS
|
|
uses: mchave3/setup-pwsh@v1.0.0
|
|
with:
|
|
version: 'stable'
|
|
- name: Determine version
|
|
id: version
|
|
run: pwsh -File scripts/determine-version.ps1 -Branch main | tee -a $env:GITHUB_OUTPUT
|
|
shell: pwsh
|
|
- name: Update version in csproj
|
|
if: steps.version.outputs.VERSION
|
|
run: pwsh -File scripts/update-version.ps1 -Version "${{ steps.version.outputs.VERSION }}"
|
|
- name: Create commit
|
|
if: steps.version.outputs.VERSION
|
|
run: |
|
|
git config user.name "gitea-actions[bot]"
|
|
git config user.email "gitea-actions[bot]@users.noreply.gitea.io"
|
|
git add -A
|
|
git commit -m "Bump version to ${{ steps.version.outputs.VERSION }}" || echo "No changes to commit"
|
|
- name: Create tag
|
|
if: steps.version.outputs.VERSION
|
|
run: |
|
|
git tag "v${{ steps.version.outputs.VERSION }}"
|
|
- name: Push changes and tags
|
|
if: steps.version.outputs.VERSION
|
|
run: |
|
|
git push origin main
|
|
git push origin v${{ steps.version.outputs.VERSION }}
|
|
- name: Restore dependencies
|
|
if: steps.version.outputs.VERSION
|
|
run: dotnet restore
|
|
- name: Build
|
|
if: steps.version.outputs.VERSION
|
|
run: dotnet build --configuration Release --no-restore
|
|
- name: Run tests
|
|
if: steps.version.outputs.VERSION
|
|
run: dotnet test --configuration Release --no-build --verbosity normal
|
|
- name: Pack
|
|
if: steps.version.outputs.VERSION
|
|
run: dotnet pack --configuration Release --no-build --output ./artifacts /p:PackageVersion=${{ steps.version.outputs.VERSION }}
|
|
- name: Push to NuGet
|
|
if: steps.version.outputs.VERSION
|
|
run: dotnet nuget push ./artifacts/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}
|