Skip to content

Commit d97f622

Browse files
committed
feat: Add nuget release workflow
1 parent 91024ad commit d97f622

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Publish NuGet Package
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repository
13+
uses: actions/checkout@v3
14+
15+
- name: Setup .NET SDK
16+
uses: actions/setup-dotnet@v3
17+
with:
18+
dotnet-version: "8.x"
19+
20+
- name: Get latest Tailwind CSS version
21+
id: get_tailwind_version
22+
run: |
23+
LATEST_TAILWIND_VERSION=$(curl -s https://api.github.com/repos/tailwindlabs/tailwindcss/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
24+
echo "TAILWINDCSS_VERSION=$LATEST_TAILWIND_VERSION" >> $GITHUB_ENV
25+
26+
- name: Extract version from tag
27+
id: extract_version
28+
run: |
29+
# remove "refs/tags/v" prefix to get version number
30+
VERSION_TAG=${GITHUB_REF#refs/tags/v}
31+
VERSION="$VERSION_TAG+${{ env.TAILWINDCSS_VERSION//v/ }}"
32+
echo "VERSION=$VERSION" >> $GITHUB_ENV
33+
34+
- name: Download TailwindCSS executables
35+
run: |
36+
chmod +x ./DotnetDevKR.TailwindCSS/runtime/install.sh
37+
./DotnetDevKR.TailwindCSS/runtime/install.sh ${{ env.TAILWINDCSS_VERSION }}
38+
39+
- name: Restore dependencies
40+
run: dotnet restore
41+
42+
- name: Pack
43+
run: |
44+
dotnet pack ./DotnetDevKR.TailwindCSS/DotnetDevKR.TailwindCSS.csproj --configuration Release \
45+
--no-build \
46+
--output ./artifacts \
47+
/p:Version=${{ env.VERSION }}
48+
49+
- name: Publish to NuGet
50+
run: |
51+
dotnet nuget push ./artifacts/*.nupkg \
52+
--source https://api.nuget.org/v3/index.json \
53+
--api-key ${{ secrets.NUGET_API_KEY }}
54+
env:
55+
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

0 commit comments

Comments
 (0)