Skip to content

Commit 7662821

Browse files
committed
Add releases.yml
1 parent ad69e2c commit 7662821

1 file changed

Lines changed: 48 additions & 0 deletions

File tree

.github/workflows/releases.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: releases
2+
3+
on:
4+
workflow_dispatch:
5+
6+
env:
7+
DOTNET_NOLOGO: true # Disable the .NET logo
8+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true # Disable the .NET first time experience
9+
DOTNET_CLI_TELEMETRY_OPTOUT: true # Disable sending .NET CLI telemetry
10+
DOTNET_VERSION: '9.0'
11+
CSPROJ_FILE_PATH: 'src/BlazorWebView/src/Microsoft.AspNetCore.Components.WebView.Gtk.csproj'
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
# Checkout the code
18+
- uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
22+
# Install .NET SDK
23+
- name: Setup .NET SDK
24+
uses: actions/setup-dotnet@v3
25+
with:
26+
dotnet-version: '${{ env.DOTNET_VERSION }}.x'
27+
28+
# Get the commit count and format the version
29+
- name: Get commit count and format version
30+
id: version
31+
shell: bash
32+
run: |
33+
commit_count=$(git rev-list --count HEAD)
34+
major=$((commit_count / 100))
35+
minor=$((commit_count % 100 / 10))
36+
patch=$((commit_count % 10))
37+
formatted_version="$major.$minor.$patch"
38+
echo "VERSION=$formatted_version" >> $GITHUB_ENV
39+
40+
- name: Build
41+
run: dotnet build ${{ env.CSPROJ_FILE_PATH }} --configuration Release --no-restore
42+
43+
- name: Pack
44+
run: dotnet pack ${{ env.CSPROJ_FILE_PATH }} -p:PackageVersion=${{ env.VERSION }} -c:Release --no-build --output nupkgs
45+
46+
- name: Push NuGet Package
47+
shell: bash
48+
run: dotnet nuget push nupkgs/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_API_KEY}}

0 commit comments

Comments
 (0)