Skip to content

Commit 6c210a0

Browse files
authored
Refactor CI workflow to streamline publish job and remove nuget_key input (#8)
1 parent 2fa5462 commit 6c210a0

File tree

2 files changed

+32
-41
lines changed

2 files changed

+32
-41
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,20 @@ jobs:
7070
new_version: ${{ steps.tag_bump.outputs.new_tag }}
7171

7272
publish:
73-
needs: generate-version
74-
runs-on: ubuntu-latest
75-
strategy:
76-
matrix:
77-
project:
78-
- name: Blake.Types
79-
path: src/Blake.Types/Blake.Types.csproj
80-
- name: Blake.MarkdownParser
81-
path: src/Blake.MarkdownParser/Blake.MarkdownParser.csproj
82-
- name: Blake.BuildTools
83-
path: src/Blake.BuildTools/Blake.BuildTools.csproj
84-
- name: Blake.CLI
85-
path: src/Blake.CLI/Blake.CLI.csproj
86-
steps:
87-
- name: Publish
88-
uses: ./.github/workflows/reusable-publish.yml@main
89-
with:
90-
project_path: ${{ matrix.project.path }}
91-
version: ${{ needs.generate-version.outputs.new_version }}
92-
nuget_key: ${{ secrets.NUGET_API_KEY }}
73+
uses: ./.github/workflows/reusable-publish.yml
74+
with:
75+
project_path: ${{ matrix.project.path }}
76+
version: ${{ needs.generate-version.outputs.new_version }}
77+
secrets: inherit
78+
needs: generate-version
79+
strategy:
80+
matrix:
81+
project:
82+
- name: Blake.Types
83+
path: src/Blake.Types/Blake.Types.csproj
84+
- name: Blake.MarkdownParser
85+
path: src/Blake.MarkdownParser/Blake.MarkdownParser.csproj
86+
- name: Blake.BuildTools
87+
path: src/Blake.BuildTools/Blake.BuildTools.csproj
88+
- name: Blake.CLI
89+
path: src/Blake.CLI/Blake.CLI.csproj

.github/workflows/reusable-publish.yml

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,23 @@ on:
1111
description: 'Version to use for packaging'
1212
type: string
1313
required: true
14-
nuget_key:
15-
description: 'NuGet API key'
16-
type: string
17-
required: true
1814

1915
jobs:
2016
package-and-publish-lib:
21-
runs-on: ubuntu-latest
22-
23-
steps:
24-
- uses: actions/checkout@v4
25-
26-
- name: Setup .NET
27-
uses: actions/setup-dotnet@v4
28-
with:
29-
dotnet-version: 9.0.x
17+
runs-on: ubuntu-latest
3018

31-
- name: Generate NuGet package
32-
run: |
33-
dotnet pack ${{ inputs.project_path }} \
34-
--configuration Release \
35-
-p:PackageVersion=${{ inputs.version }} \
36-
-o packages
19+
steps:
20+
- uses: actions/checkout@v4
3721

38-
- name: Publish NuGet package
39-
run: dotnet nuget push packages/*.nupkg --api-key ${{ inputs.nuget_key }} --source https://api.nuget.org/v3/index.json
22+
- name: Setup .NET
23+
uses: actions/setup-dotnet@v4
24+
with:
25+
dotnet-version: 9.0.x
26+
- name: Generate NuGet package
27+
run: |
28+
dotnet pack ${{ inputs.project_path }} \
29+
--configuration Release \
30+
-p:PackageVersion=${{ inputs.version }} \
31+
-o packages
32+
- name: Publish NuGet package
33+
run: dotnet nuget push packages/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json

0 commit comments

Comments
 (0)