Skip to content

Commit fcb2f9d

Browse files
committed
Melhoradas os workflows de publicação.
1 parent 91f4a66 commit fcb2f9d

2 files changed

Lines changed: 79 additions & 18 deletions

File tree

.github/workflows/publish.yml

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
22
name: publish
33
on:
44
workflow_dispatch: # Allow running the workflow manually from the GitHub UI
@@ -9,7 +9,6 @@ on:
99
env:
1010
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
1111
DOTNET_NOLOGO: true
12-
PROJECT_NAME: OpenAC.Net.DFe.Core
1312
NuGetDirectory: ${{ github.workspace }}/nuget
1413

1514
defaults:
@@ -24,25 +23,32 @@ jobs:
2423
with:
2524
fetch-depth: 0 # Get all history to allow automatic versioning using MinVer
2625

27-
- name: Setup NuGet
28-
uses: nuget/setup-nuget@v2
29-
30-
- name: Restore NuGet packages
31-
run: nuget restore ${{ env.PROJECT_NAME }}.sln
32-
working-directory: src
33-
3426
# Install the .NET SDK indicated in the global.json file
3527
- name: Setup .NET
36-
uses: actions/setup-dotnet@v4
28+
uses: actions/setup-dotnet@v5.0.0
3729
with:
38-
dotnet-version: '8.x'
39-
- run: dotnet msbuild ${{ env.PROJECT_NAME }}.sln -property:Configuration=Release -property:platform="Any CPU"
30+
dotnet-version: |
31+
8.x
32+
9.x
33+
10.x
34+
35+
- name: Setup NuGet
36+
uses: nuget/setup-nuget@v2.0.1
37+
38+
- name: Restore NuGet packages
39+
run: nuget restore OpenAC.Net.DFe.Core.sln
4040
working-directory: src
41-
- run: dotnet pack --configuration Release --output ${{ env.NuGetDirectory }}
41+
42+
- name: Build solution
43+
run: dotnet msbuild OpenAC.Net.DFe.Core.sln -property:Configuration=Release -property:platform="Any CPU"
4244
working-directory: src
4345

46+
- name: Pack NuGet package
47+
run: dotnet pack --configuration Release --output ${{ env.NuGetDirectory }}
48+
working-directory: src
49+
4450
# Publish the NuGet package as an artifact, so they can be used in the following jobs
45-
- uses: actions/upload-artifact@v4
51+
- uses: actions/upload-artifact@v5
4652
with:
4753
name: nuget
4854
if-no-files-found: error
@@ -55,10 +61,10 @@ jobs:
5561
steps:
5662
# Install the .NET SDK indicated in the global.json file
5763
- name: Setup .NET
58-
uses: actions/setup-dotnet@v4
64+
uses: actions/setup-dotnet@v5
5965

6066
# Download the NuGet package created in the previous job
61-
- uses: actions/download-artifact@v4
67+
- uses: actions/download-artifact@v6
6268
with:
6369
name: nuget
6470
path: ${{ env.NuGetDirectory }}
@@ -73,7 +79,7 @@ jobs:
7379
- name: Validate package
7480
run: meziantou.validate-nuget-package (Get-ChildItem "${{ env.NuGetDirectory }}/*.nupkg")
7581

76-
deploy:
82+
publish_nuget:
7783
# Publish only when creating a GitHub Release
7884
# https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
7985
# You can update this logic if you want to manage releases differently
@@ -98,4 +104,15 @@ jobs:
98104
run: |
99105
foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) {
100106
dotnet nuget push $file --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
101-
}
107+
}
108+
109+
webhook:
110+
runs-on: ubuntu-latest
111+
needs: [ publish_nuget ]
112+
env:
113+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
114+
steps:
115+
- name: Discord notification
116+
uses: Ilshidur/action-discord@0.4.0
117+
with:
118+
args: 'Uma nova versão do **OpenAC.Net.DFe.Core** foi publicada! Confira agora em [NuGet.org](https://www.nuget.org/packages/OpenAC.Net.DFe.Core).'

.github/workflows/push.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
name: build
3+
on:
4+
workflow_dispatch: # Allow running the workflow manually from the GitHub UI
5+
push:
6+
branches:
7+
- main
8+
9+
env:
10+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
11+
DOTNET_NOLOGO: true
12+
NuGetDirectory: ${{ github.workspace }}/nuget
13+
14+
defaults:
15+
run:
16+
shell: pwsh
17+
18+
jobs:
19+
build_solution:
20+
runs-on: windows-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0 # Get all history to allow automatic versioning using MinVer
25+
26+
# Install the .NET SDK indicated in the global.json file
27+
- name: Setup .NET
28+
uses: actions/setup-dotnet@v5.0.0
29+
with:
30+
dotnet-version: |
31+
8.x
32+
9.x
33+
10.x
34+
35+
- name: Setup NuGet
36+
uses: nuget/setup-nuget@v2.0.1
37+
38+
- name: Restore NuGet packages
39+
run: nuget restore OpenAC.Net.DFe.Core.sln
40+
working-directory: src
41+
42+
- name: Build solution
43+
run: dotnet msbuild OpenAC.Net.DFe.Core.sln -property:Configuration=Release -property:platform="Any CPU"
44+
working-directory: src

0 commit comments

Comments
 (0)