mirror of
https://github.com/bizzehdee/bzTorrent.git
synced 2026-10-27 03:59:55 +08:00
60 lines
1.6 KiB
YAML
60 lines
1.6 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'version/[0-9]+.[0-9]+.[0-9]+'
|
|
|
|
jobs:
|
|
release:
|
|
name: Build and Release
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
id-token: write
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Extract version from tag
|
|
id: version
|
|
run: echo "VERSION=${GITHUB_REF_NAME#version/}" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: '8.x'
|
|
|
|
- name: Patch csproj version
|
|
run: |
|
|
sed -i 's|<Version>.*</Version>|<Version>${{ steps.version.outputs.VERSION }}</Version>|' bzTorrent/bzTorrent.csproj
|
|
|
|
- name: Restore
|
|
run: dotnet restore
|
|
|
|
- name: Build
|
|
run: dotnet build --configuration Release --no-restore
|
|
|
|
- name: Test
|
|
run: dotnet test --configuration Release --no-build --verbosity normal
|
|
|
|
- name: Pack
|
|
run: dotnet pack bzTorrent/bzTorrent.csproj --configuration Release --no-build --output ./artifacts
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
name: v${{ steps.version.outputs.VERSION }}
|
|
files: ./artifacts/*.nupkg
|
|
generate_release_notes: true
|
|
|
|
- name: NuGet login
|
|
uses: NuGet/login@v1
|
|
id: nuget-login
|
|
with:
|
|
user: ${{ secrets.NUGET_USER }}
|
|
|
|
- name: Push to NuGet.org
|
|
run: dotnet nuget push ./artifacts/*.nupkg --api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
|