Skip to content

Commit 03449bd

Browse files
committed
Adicionado o Github Actions
1 parent 7fba080 commit 03449bd

3 files changed

Lines changed: 153 additions & 53 deletions

File tree

.github/FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl
99
liberapay: # Replace with a single Liberapay username
1010
issuehunt: # Replace with a single IssueHunt username
1111
otechie: # Replace with a single Otechie username
12-
custom: ['https://www.padrim.com.br/openac-net', 'https://apoia.se/openac-net'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
12+
custom: ['https://apoia.se/openac-net'] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

.github/workflows/publish.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
2+
name: publish
3+
on:
4+
workflow_dispatch: # Allow running the workflow manually from the GitHub UI
5+
release:
6+
types:
7+
- published # Run the workflow when a new GitHub release is published
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+
create_nuget:
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+
- name: Setup NuGet
27+
uses: nuget/setup-nuget@v2
28+
29+
- name: Restore NuGet packages
30+
run: nuget restore OpenAC.Net.GNRe.sln
31+
working-directory: src
32+
33+
# Install the .NET SDK indicated in the global.json file
34+
- name: Setup .NET
35+
uses: actions/setup-dotnet@v4
36+
with:
37+
dotnet-version: |
38+
8.x
39+
9.x
40+
- run: dotnet msbuild OpenAC.Net.GNRe.sln -property:Configuration=Release -property:platform="Any CPU"
41+
working-directory: src
42+
- run: dotnet pack --configuration Release --output ${{ env.NuGetDirectory }}
43+
working-directory: src
44+
45+
# Publish the NuGet package as an artifact, so they can be used in the following jobs
46+
- uses: actions/upload-artifact@v4
47+
with:
48+
name: nuget
49+
if-no-files-found: error
50+
retention-days: 7
51+
path: ${{ env.NuGetDirectory }}/*.nupkg
52+
53+
validate_nuget:
54+
runs-on: ubuntu-latest
55+
needs: [ create_nuget ]
56+
steps:
57+
# Install the .NET SDK indicated in the global.json file
58+
- name: Setup .NET
59+
uses: actions/setup-dotnet@v4
60+
61+
# Download the NuGet package created in the previous job
62+
- uses: actions/download-artifact@v4
63+
with:
64+
name: nuget
65+
path: ${{ env.NuGetDirectory }}
66+
67+
- name: Install nuget validator
68+
run: dotnet tool update Meziantou.Framework.NuGetPackageValidation.Tool --global
69+
70+
# Validate metadata and content of the NuGet package
71+
# https://www.nuget.org/packages/Meziantou.Framework.NuGetPackageValidation.Tool#readme-body-tab
72+
# If some rules are not applicable, you can disable them
73+
# using the --excluded-rules or --excluded-rule-ids option
74+
- name: Validate package
75+
run: meziantou.validate-nuget-package (Get-ChildItem "${{ env.NuGetDirectory }}/*.nupkg")
76+
77+
deploy:
78+
# Publish only when creating a GitHub Release
79+
# https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository
80+
# You can update this logic if you want to manage releases differently
81+
if: github.event_name == 'release'
82+
runs-on: ubuntu-latest
83+
needs: [ validate_nuget ]
84+
steps:
85+
# Download the NuGet package created in the previous job
86+
- uses: actions/download-artifact@v4
87+
with:
88+
name: nuget
89+
path: ${{ env.NuGetDirectory }}
90+
91+
# Install the .NET SDK indicated in the global.json file
92+
- name: Setup .NET Core
93+
uses: actions/setup-dotnet@v4
94+
95+
# Publish all NuGet packages to NuGet.org
96+
# Use --skip-duplicate to prevent errors if a package with the same version already exists.
97+
# If you retry a failed workflow, already published packages will be skipped without error.
98+
- name: Publish NuGet package
99+
run: |
100+
foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) {
101+
dotnet nuget push $file --api-key "${{ secrets.NUGET_APIKEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
102+
}
Lines changed: 50 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,83 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net452;netstandard2.0</TargetFrameworks>
4+
<TargetFrameworks>net462;net470;net48;netstandard2.0;net6.0;net7.0;net8.0;net9.0</TargetFrameworks>
55
<LangVersion>latest</LangVersion>
66
<AssemblyName>OpenAC.Net.GNRe</AssemblyName>
77
<RootNamespace>OpenAC.Net.GNRe</RootNamespace>
88
<SignAssembly>true</SignAssembly>
9-
<AssemblyOriginatorKeyFile>OpenAC.snk</AssemblyOriginatorKeyFile>
10-
<Copyright>Copyright © Projeto OpenAC .Net 2014 - 2021</Copyright>
11-
<Company>OpenAC .Net - Automação Comercial em .Net</Company>
12-
<Authors>Projeto OpenAC .Net</Authors>
13-
<PackageProjectUrl>https://openac-net.github.io/</PackageProjectUrl>
14-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
9+
<AssemblyOriginatorKeyFile>OpenAC.snk</AssemblyOriginatorKeyFile>
10+
<Copyright>Copyright © Projeto OpenAC .Net 2014 - 2025</Copyright>
11+
<Company>OpenAC .Net - Automação Comercial em .Net</Company>
12+
<Authors>Projeto OpenAC .Net</Authors>
13+
<PackageProjectUrl>https://openac.net.br/</PackageProjectUrl>
14+
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
15+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
16+
<PackageIcon>nuget.png</PackageIcon>
1517
<PackageIconUrl>https://avatars.githubusercontent.com/u/90476515?s=200&amp;v=4</PackageIconUrl>
1618
<RepositoryUrl>https://github.com/OpenAC-Net/OpenAC.Net.GNRe</RepositoryUrl>
1719
<RepositoryType>git</RepositoryType>
1820
<PackageTags>OpenAC .Net GNRe</PackageTags>
19-
<Description>Projeto para consumo do webservice de Gnre nacional</Description>
20-
<NeutralLanguage>pt-BR</NeutralLanguage>
21-
<PackageLicenseFile>LICENSE</PackageLicenseFile>
22-
<AssemblyVersion>1.5.0.2</AssemblyVersion>
23-
<FileVersion>1.5.0.2</FileVersion>
24-
<Version>1.5.0.2</Version>
21+
<PackageLicenseFile>LICENSE</PackageLicenseFile>
22+
<PackageReadmeFile>README.md</PackageReadmeFile>
23+
<NeutralLanguage>pt-BR</NeutralLanguage>
24+
<AssemblyVersion>1.6.0.0</AssemblyVersion>
25+
<FileVersion>1.6.0.0</FileVersion>
26+
<Version>1.6.0.0</Version>
2527
<PublishRepositoryUrl>true</PublishRepositoryUrl>
2628
<EmbedUntrackedSources>true</EmbedUntrackedSources>
2729
<DebugType>embedded</DebugType>
2830
<IncludeSymbols>true</IncludeSymbols>
29-
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
30-
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
31+
<DebugType>embedded</DebugType>
32+
<IncludeSymbols>true</IncludeSymbols>
33+
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
34+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
35+
<Description>Projeto para consumo do webservice de Gnre nacional</Description>
3136
</PropertyGroup>
3237

33-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
34-
<DefineConstants>NETCORE;NETSTANDARD;NETSTANDARD2_0</DefineConstants>
35-
</PropertyGroup>
36-
37-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net452'">
38-
<DefineConstants>NET45;NETFULL</DefineConstants>
39-
</PropertyGroup>
40-
41-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net452|AnyCPU'">
42-
<OutputPath>..\..\bin\Debug\</OutputPath>
43-
<DocumentationFile>..\..\bin\Debug\net452\OpenAC.Net.GNRe.xml</DocumentationFile>
44-
</PropertyGroup>
45-
46-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net452|AnyCPU'">
47-
<OutputPath>..\..\bin\Release\</OutputPath>
48-
<DocumentationFile>..\..\bin\Release\net452\OpenAC.Net.GNRe.xml</DocumentationFile>
49-
</PropertyGroup>
50-
51-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|netstandard2.0|AnyCPU'">
52-
<OutputPath>..\..\bin\Debug\</OutputPath>
53-
<DocumentationFile>..\..\bin\Debug\netstandard2.0\OpenAC.Net.GNRe.xml</DocumentationFile>
54-
</PropertyGroup>
55-
56-
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|netstandard2.0|AnyCPU'">
57-
<OutputPath>..\..\bin\Release\</OutputPath>
58-
<DocumentationFile>..\..\bin\Release\netstandard2.0\OpenAC.Net.GNRe.xml</DocumentationFile>
59-
</PropertyGroup>
60-
6138
<ItemGroup>
62-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
63-
<PrivateAssets>all</PrivateAssets>
64-
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
65-
</PackageReference>
66-
<PackageReference Include="OpenAC.Net.Core" Version="1.5.0.1" />
67-
<PackageReference Include="OpenAC.Net.DFe.Core" Version="1.5.0.2" />
68-
<PackageReference Include="System.ServiceModel.Http" Version="4.10.0" />
39+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
40+
<PrivateAssets>all</PrivateAssets>
41+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
42+
</PackageReference>
43+
<PackageReference Include="OpenAC.Net.Core" Version="1.6.0" />
44+
<PackageReference Include="OpenAC.Net.DFe.Core" Version="1.6.0.2" />
6945
</ItemGroup>
7046

71-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
47+
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0'">
48+
<PackageReference Include="System.ServiceModel.Http" Version="8.1.2" />
49+
</ItemGroup>
50+
51+
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net9.0'">
52+
<PackageReference Include="System.ServiceModel.Http" Version="8.1.2" />
53+
</ItemGroup>
54+
55+
56+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'net6.0' or '$(TargetFramework)' == 'net7.0' or '$(TargetFramework)' == 'net8.0' or '$(TargetFramework)' == 'net9.0' ">
7257
<PackageReference Include="System.Security.Cryptography.Xml" Version="6.0.1" />
7358
</ItemGroup>
7459

75-
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
60+
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'net470' or '$(TargetFramework)' == 'net48' ">
7661
<Reference Include="System.Drawing" />
7762
<Reference Include="System.ServiceModel" />
7863
<Reference Include="System.Security" />
7964
</ItemGroup>
8065

8166
<ItemGroup>
67+
<None Include="..\..\LICENSE">
68+
<Pack>True</Pack>
69+
<PackagePath>/</PackagePath>
70+
</None>
71+
<None Include="..\..\nuget.png">
72+
<Pack>True</Pack>
73+
<PackagePath />
74+
<Link>nuget.png</Link>
75+
</None>
8276
<None Include="..\..\LICENSE" Pack="true" PackagePath="\" />
77+
<None Include="..\..\Schemas\**\*.*">
78+
<Pack>True</Pack>
79+
<PackagePath>content\Schemas\</PackagePath>
80+
</None>
8381
</ItemGroup>
8482

8583
</Project>

0 commit comments

Comments
 (0)