forked from ZeusAutomacao/DFe.NET
-
Notifications
You must be signed in to change notification settings - Fork 15
feat(nuget): habilitar publicação dos 6 projetos netstandard como pacotes NuGet #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| name: Publish NuGet | ||
|
|
||
| # Empacota e publica os 6 projetos NFe/DFe netstandard como pacotes NuGet | ||
| # em GitHub Packages (feed da org nfe). | ||
| # | ||
| # Triggers: | ||
| # - push de tag v* → release versionada (pega a versão da tag) | ||
| # - workflow_dispatch → execução manual para testes (versão informada | ||
| # como input ou fallback 0.0.0-manual.{run_number}) | ||
| # | ||
| # Pré-requisitos no consumidor: | ||
| # 1. nuget.config com source apontando para https://nuget.pkg.github.com/nfe/index.json | ||
| # 2. PAT com escopo read:packages adicionado como secret/login NuGet | ||
| # | ||
| # Pacotes publicados: NFEio.DFe.Classes, NFEio.DFe.Utils, NFEio.NFe.Classes, | ||
| # NFEio.NFe.Servicos, NFEio.NFe.Utils, NFEio.NFe.Wsdl. | ||
|
|
||
| on: | ||
| push: | ||
| tags: | ||
| - 'v*' | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: 'Versão a publicar (ex: 1.0.0-rc.1). Vazio = 0.0.0-manual.{run_number}' | ||
| required: false | ||
| type: string | ||
|
|
||
| permissions: | ||
| contents: read | ||
| packages: write | ||
|
|
||
| jobs: | ||
| pack-and-publish: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup .NET | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: '8.0.x' | ||
|
|
||
| - name: Resolve version | ||
| id: version | ||
| run: | | ||
| if [[ "${{ github.event_name }}" == "push" ]]; then | ||
| # tag refs/tags/vX.Y.Z → X.Y.Z | ||
| VERSION="${GITHUB_REF_NAME#v}" | ||
| elif [[ -n "${{ inputs.version }}" ]]; then | ||
| VERSION="${{ inputs.version }}" | ||
| else | ||
| VERSION="0.0.0-manual.${{ github.run_number }}" | ||
| fi | ||
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | ||
| echo "Resolved version: $VERSION" | ||
|
|
||
| - name: Pack projects | ||
| run: | | ||
| for proj in DFe.Classes DFe.Utils NFe.Classes NFe.Servicos NFe.Utils NFe.Wsdl; do | ||
| echo "::group::Pack $proj" | ||
| dotnet pack "$proj/$proj.csproj" \ | ||
| --configuration Release \ | ||
| --output ./artifacts \ | ||
| -p:Version=${{ steps.version.outputs.version }} | ||
| echo "::endgroup::" | ||
| done | ||
|
|
||
| - name: List artifacts | ||
| run: ls -la ./artifacts | ||
|
|
||
| - name: Push packages (.nupkg) to GitHub Packages | ||
| run: | | ||
| dotnet nuget push './artifacts/*.nupkg' \ | ||
| --source https://nuget.pkg.github.com/nfe/index.json \ | ||
| --api-key ${{ secrets.GITHUB_TOKEN }} \ | ||
| --skip-duplicate | ||
|
|
||
| # Symbol packages (.snupkg) precisam de push separado — o glob *.nupkg | ||
| # acima não os captura, e o Directory.Build.props declara IncludeSymbols | ||
| # com SymbolPackageFormat=snupkg. Sem este passo os consumidores não | ||
| # conseguem PDBs nem SourceLink (debugging quebrado). GitHub Packages | ||
| # suporta .snupkg desde 2020. | ||
| - name: Push symbol packages (.snupkg) to GitHub Packages | ||
| run: | | ||
| dotnet nuget push './artifacts/*.snupkg' \ | ||
| --source https://nuget.pkg.github.com/nfe/index.json \ | ||
| --api-key ${{ secrets.GITHUB_TOKEN }} \ | ||
| --skip-duplicate | ||
|
|
||
| - name: Upload artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: nuget-packages-${{ steps.version.outputs.version }} | ||
| path: ./artifacts/*.*nupkg | ||
| retention-days: 30 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| <Project> | ||
|
|
||
| <!-- | ||
| Propriedades comuns dos pacotes NuGet publicados pelo fork nfe/DFe.NET. | ||
|
|
||
| Cada projeto packável (DFe.Classes, DFe.Utils, NFe.Classes, NFe.Servicos, | ||
| NFe.Utils, NFe.Wsdl) sobrescreve <PackageId> e <Description>. Os demais | ||
| metadados (autoria, licença, URLs, símbolos) vivem aqui para evitar | ||
| drift entre os 6 csproj. | ||
|
|
||
| Versionamento: <Version> é injetada pela pipeline CI (.github/workflows/ | ||
| nuget-publish.yml) extraindo de tags `v*`. Fallback `1.0.0-local` permite | ||
| `dotnet pack` rodar localmente para testes sem CI. | ||
| --> | ||
| <PropertyGroup> | ||
| <Version Condition="'$(Version)' == ''">1.0.0-local</Version> | ||
| <Authors>NFE.io</Authors> | ||
| <Company>NFE.io</Company> | ||
| <Copyright>Copyright (c) NFE.io e contribuidores Zeus (Zeusdev Tecnologia LTDA)</Copyright> | ||
| <PackageLicenseExpression>LGPL-2.1-or-later</PackageLicenseExpression> | ||
| <PackageProjectUrl>https://github.com/nfe/DFe.NET</PackageProjectUrl> | ||
| <RepositoryUrl>https://github.com/nfe/DFe.NET</RepositoryUrl> | ||
| <RepositoryType>git</RepositoryType> | ||
| <PackageTags>nfe;nfce;sefaz;dfe;rtc;reforma-tributaria;nfeio</PackageTags> | ||
| <IncludeSymbols>true</IncludeSymbols> | ||
| <SymbolPackageFormat>snupkg</SymbolPackageFormat> | ||
| <PublishRepositoryUrl>true</PublishRepositoryUrl> | ||
| <EmbedUntrackedSources>true</EmbedUntrackedSources> | ||
| <PackageReadmeFile>README.md</PackageReadmeFile> | ||
| </PropertyGroup> | ||
|
|
||
| <!-- | ||
| README.md da raiz do repo incluído em todos os pacotes (mesma fonte). | ||
| Necessário porque o NuGet 5.10+ exige PackageReadmeFile referenciando | ||
| arquivo do próprio diretório do projeto OU explicitamente Pack=true. | ||
| --> | ||
| <ItemGroup> | ||
| <None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="\" Visible="false" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.