Skip to content

Commit e77b3ea

Browse files
committed
publish
1 parent 1927d4e commit e77b3ea

1 file changed

Lines changed: 56 additions & 23 deletions

File tree

.github/workflows/ci.yml

Lines changed: 56 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ name: Build .NET lib
55

66
on:
77
push:
8-
branches: ["main"]
8+
branches: ["develop"]
99
pull_request:
1010
branches: ["main"]
1111
workflow_dispatch:
@@ -17,7 +17,10 @@ on:
1717

1818
env:
1919
PRODUCT_NAME: TeamTools.Linter.TSQL
20+
TEST_PROJECT: TeamTools.TSQL.LinterTests
21+
PUBLISH_PROJECT_PATH: TeamTools.TSQL.Linter/TeamTools.TSQL.Linter.csproj
2022
OUTPUT_PATH: ${{ github.workspace }}/.bin/
23+
PUBLISH_PATH: ${{ github.workspace }}/.pub/
2124

2225
jobs:
2326
semver:
@@ -52,6 +55,8 @@ jobs:
5255
name: Build and test
5356
needs: semver
5457
runs-on: ${{ matrix.os }}
58+
outputs:
59+
build-result: ${{ steps.bundle-status.outputs.BUNDLE_STATUS }}
5560

5661
defaults:
5762
run:
@@ -66,6 +71,9 @@ jobs:
6671
- os: windows-latest
6772
configuration: Debug
6873
coverage: true
74+
- os: windows-latest
75+
configuration: Release
76+
publish: true
6977

7078
steps:
7179
- uses: actions/checkout@v4
@@ -92,7 +100,7 @@ jobs:
92100
run: |
93101
dotnet add package coverlet.msbuild --version 6.0.4 &&
94102
dotnet add package coverlet.collector --version 6.0.4
95-
working-directory: TeamTools.TSQL.LinterTests
103+
working-directory: ${{ env.TEST_PROJECT }}
96104

97105
- name: Restore dependencies
98106
run: dotnet restore --p:ContinuousIntegrationBuild=true
@@ -110,6 +118,52 @@ jobs:
110118
-p:RepositoryBranch="${{ github.ref_name }}"
111119
-p:BaseOutputPath="${{ env.OUTPUT_PATH }}"
112120
121+
- name: Set bundle status
122+
id: bundle-status
123+
if: ${{ matrix.publish }}
124+
run: |
125+
echo "BUNDLE_STATUS=${{ steps.build.conclusion }}" >> $GITHUB_OUTPUT
126+
127+
- name: Prepare publish package per framework
128+
if: ${{ matrix.publish }}
129+
run: >
130+
dotnet publish "${{ env.PUBLISH_PROJECT_PATH }}" --no-build
131+
-p:TargetFramework=netstandard2.0
132+
-p:Configuration=${{ matrix.configuration }}
133+
-p:BaseOutputPath="${{ env.OUTPUT_PATH }}"
134+
-p:PublishDir="${{ env.PUBLISH_PATH }}/Release/netstandard2.0"
135+
&& dotnet publish "${{ env.PUBLISH_PROJECT_PATH }}" --no-build
136+
-p:TargetFramework=net6.0
137+
-p:Configuration=${{ matrix.configuration }}
138+
-p:BaseOutputPath="${{ env.OUTPUT_PATH }}"
139+
-p:PublishDir="${{ env.PUBLISH_PATH }}/Release/net6.0"
140+
&& dotnet publish "${{ env.PUBLISH_PROJECT_PATH }}" --no-build
141+
-p:TargetFramework=net8.0
142+
-p:Configuration=${{ matrix.configuration }}
143+
-p:BaseOutputPath="${{ env.OUTPUT_PATH }}"
144+
-p:PublishDir="${{ env.PUBLISH_PATH }}/Release/net8.0"
145+
146+
- name: Upload build artifacts 2.0
147+
uses: actions/upload-artifact@v4
148+
if: ${{ matrix.publish }}
149+
with:
150+
name: ${{ env.PRODUCT_NAME }}-${{ needs.semver.outputs.next-version }}-${{ matrix.configuration }}-netstandard2.0
151+
path: ${{ env.PUBLISH_PATH }}/${{ matrix.configuration }}/netstandard2.0
152+
153+
- name: Upload build artifacts 6.0
154+
uses: actions/upload-artifact@v4
155+
if: ${{ matrix.publish }}
156+
with:
157+
name: ${{ env.PRODUCT_NAME }}-${{ needs.semver.outputs.next-version }}-${{ matrix.configuration }}-net6.0
158+
path: ${{ env.PUBLISH_PATH }}/${{ matrix.configuration }}/net6.0
159+
160+
- name: Upload build artifacts 8.0
161+
uses: actions/upload-artifact@v4
162+
if: ${{ matrix.publish }}
163+
with:
164+
name: ${{ env.PRODUCT_NAME }}-${{ needs.semver.outputs.next-version }}-${{ matrix.configuration }}-net8.0
165+
path: ${{ env.PUBLISH_PATH }}/${{ matrix.configuration }}/net8.0
166+
113167
- name: Upload test bundle
114168
uses: actions/upload-artifact@v4
115169
if: ${{ matrix.configuration == 'Debug' && matrix.os == 'windows-latest' && steps.build.conclusion == 'success' && !cancelled() }}
@@ -149,27 +203,6 @@ jobs:
149203
path: "**/TestResults/*.trx,*.trx"
150204
reporter: dotnet-trx
151205

152-
- name: Upload build artifacts 2.0
153-
uses: actions/upload-artifact@v4
154-
if: ${{ matrix.configuration == 'Release' && matrix.os == 'windows-latest' && steps.build.conclusion == 'success' && !cancelled() }}
155-
with:
156-
name: ${{ env.PRODUCT_NAME }}-${{ needs.semver.outputs.next-version }}-${{ matrix.configuration }}-netstandard2.0
157-
path: ${{ env.OUTPUT_PATH }}/${{ matrix.configuration }}/netstandard2.0
158-
159-
- name: Upload build artifacts 6.0
160-
uses: actions/upload-artifact@v4
161-
if: ${{ matrix.configuration == 'Release' && matrix.os == 'windows-latest' && steps.build.conclusion == 'success' && !cancelled() }}
162-
with:
163-
name: ${{ env.PRODUCT_NAME }}-${{ needs.semver.outputs.next-version }}-${{ matrix.configuration }}-net6.0
164-
path: ${{ env.OUTPUT_PATH }}/${{ matrix.configuration }}/net6.0
165-
166-
- name: Upload build artifacts 8.0
167-
uses: actions/upload-artifact@v4
168-
if: ${{ matrix.configuration == 'Release' && matrix.os == 'windows-latest' && steps.build.conclusion == 'success' && !cancelled() }}
169-
with:
170-
name: ${{ env.PRODUCT_NAME }}-${{ needs.semver.outputs.next-version }}-${{ matrix.configuration }}-net8.0
171-
path: ${{ env.OUTPUT_PATH }}/${{ matrix.configuration }}/net8.0
172-
173206
validate-markdown:
174207
runs-on: ubuntu-latest
175208
steps:

0 commit comments

Comments
 (0)