Skip to content
This repository was archived by the owner on Mar 2, 2026. It is now read-only.

Commit 67f1ee3

Browse files
committed
Add publish workflow
1 parent 5093127 commit 67f1ee3

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: publish
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- '*'
8+
9+
jobs:
10+
11+
build:
12+
13+
permissions:
14+
contents: write
15+
16+
runs-on: windows-latest
17+
18+
env:
19+
Solution_Path: AnyBar.Localization.slnx
20+
Project_Path: AnyBar.Localization\AnyBar.Localization.csproj
21+
22+
steps:
23+
24+
# Checkout codes
25+
- name: Checkout
26+
uses: actions/checkout@v4
27+
28+
# Install the .NET Core workload
29+
- name: Setup .NET
30+
uses: actions/setup-dotnet@v4
31+
with:
32+
dotnet-version: |
33+
7.0.x
34+
35+
# Restore dependencies
36+
- name: Restore dependencies
37+
run: dotnet restore ${{ env.Solution_Path }}
38+
39+
# Build the project
40+
- name: Build
41+
run: dotnet build ${{ env.Solution_Path }} --configuration Release --no-restore
42+
43+
# Execute all unit tests in the solution
44+
- name: Execute unit tests
45+
run: dotnet test ${{ env.Solution_Path }} --configuration Release --no-build
46+
47+
# Pack the NuGet package
48+
- name: Create NuGet package
49+
run: dotnet pack ${{ env.Project_Path }} --configuration Release --no-build --output nupkgs
50+
51+
# Publish to NuGet.org
52+
- name: Push to NuGet
53+
run: nuget push nupkgs\*.nupkg -source 'https://api.nuget.org/v3/index.json' -apikey ${{ secrets.NUGET_API_KEY }}
54+
55+
# Get package version
56+
- name: Get Package Version
57+
run: |
58+
$version = [system.diagnostics.fileversioninfo]::getversioninfo("AnyBar.Localization\bin\Release\AnyBar.Localization.dll").fileversion
59+
echo "release_version=$version" | out-file -filepath $env:github_env -encoding utf-8 -append
60+
61+
# Publish to GitHub releases
62+
- name: Publish
63+
uses: softprops/action-gh-release@v2
64+
with:
65+
files: nupkgs/*.nupkg
66+
tag_name: "v${{ env.release_version }}"

0 commit comments

Comments
 (0)