Skip to content

Commit eecee00

Browse files
Add GitHub Actions workflow for build and publish
1 parent dafda3b commit eecee00

File tree

1 file changed

+135
-0
lines changed

1 file changed

+135
-0
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: Build and Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
env:
9+
BUILD_CONFIGURATION: Release
10+
DOTNET_VERSION: '9.x'
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
version: ${{ steps.version.outputs.version }}
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Setup .NET
24+
uses: actions/setup-dotnet@v4
25+
with:
26+
dotnet-version: ${{ env.DOTNET_VERSION }}
27+
28+
- name: Get version from tag
29+
id: version
30+
run: |
31+
VERSION="${{ github.ref_name }}"
32+
echo "Version: $VERSION"
33+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
34+
35+
- name: Build
36+
run: |
37+
dotnet build Infragistics.QueryBuilder.Executor.csproj \
38+
-c ${{ env.BUILD_CONFIGURATION }} \
39+
/p:Version=${{ steps.version.outputs.version }}
40+
41+
- name: Upload entire bin directory
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: build-output
45+
path: bin/
46+
retention-days: 1
47+
48+
sign-dlls:
49+
needs: build
50+
uses: IgniteUI/igniteui-actions/.github/workflows/sign-dlls.yml@master
51+
with:
52+
artifact-name: build-output
53+
signed-artifact-name: signed-build-output
54+
secrets: inherit
55+
56+
pack:
57+
needs: [build, sign-dlls]
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@v4
62+
63+
- name: Setup .NET
64+
uses: actions/setup-dotnet@v4
65+
with:
66+
dotnet-version: ${{ env.DOTNET_VERSION }}
67+
68+
- name: Download signed build output
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: signed-build-output
72+
path: bin/
73+
74+
- name: Debug - List restored bin directory
75+
run: |
76+
echo "Contents of bin/:"
77+
find bin/ -type f | sort
78+
79+
- name: Pack NuGet package
80+
run: |
81+
VERSION="${{ needs.build.outputs.version }}"
82+
echo "Packing version: $VERSION"
83+
84+
dotnet pack Infragistics.QueryBuilder.Executor.csproj \
85+
--no-build \
86+
--configuration ${{ env.BUILD_CONFIGURATION }} \
87+
-p:PackageVersion="$VERSION" \
88+
-o ./nupkg
89+
90+
- name: Upload unsigned NuGet package
91+
uses: actions/upload-artifact@v4
92+
with:
93+
name: unsigned-nuget
94+
path: ./nupkg/*.nupkg
95+
retention-days: 1
96+
97+
sign-nuget:
98+
needs: pack
99+
uses: IgniteUI/igniteui-actions/.github/workflows/sign-nuget-package.yml@master
100+
with:
101+
artifact-name: unsigned-nuget
102+
signed-artifact-name: signed-nuget
103+
secrets: inherit
104+
105+
publish:
106+
needs: [build, sign-nuget]
107+
runs-on: ubuntu-latest
108+
environment: nuget-publish
109+
permissions:
110+
id-token: write
111+
contents: read
112+
steps:
113+
- name: Download signed NuGet package
114+
uses: actions/download-artifact@v4
115+
with:
116+
name: signed-nuget
117+
path: ./packages
118+
119+
- name: Setup .NET
120+
uses: actions/setup-dotnet@v4
121+
with:
122+
dotnet-version: ${{ env.DOTNET_VERSION }}
123+
124+
- name: NuGet login (OIDC → temp API key)
125+
uses: nuget/login@v1
126+
id: nuget-login
127+
with:
128+
user: ${{ secrets.INFRAGISTICS_NUGET_ORG_USER }}
129+
130+
- name: Publish to NuGet.org
131+
run: |
132+
VERSION="${{ needs.build.outputs.version }}"
133+
dotnet nuget push ./packages/Infragistics.QueryBuilder.Executor.${VERSION}.nupkg \
134+
--api-key ${{ steps.nuget-login.outputs.nuget-api-key }} \
135+
--source https://api.nuget.org/v3/index.json

0 commit comments

Comments
 (0)