DFe.NET_build #224
This file contains 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
name: DFe.NET_build | |
on: | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'warning' | |
nugetdeploy: | |
type: boolean | |
description: 'Deploy Nuget ?' | |
push: | |
branches: | |
- 'master' | |
pull_request: | |
types: [opened, reopened] | |
branches: | |
- 'master' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
outputs: | |
version: ${{ steps.date.outputs.date }} | |
strategy: | |
matrix: | |
# os: [ ubuntu-latest, windows-latest, macos-latest ] | |
os: [ windows-2022 ] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setando Versao | |
id: date | |
run: echo "::set-output name=date::$(date +'%Y.%m.%d.%H%M')" | |
- name: Versao | |
run: echo ${{ steps.date.outputs.date }} | |
- name: Setup .NET 6.0.x | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 6.0.x | |
- name: Build/Restore Base | |
run: | | |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\DFe.Classes\DFe.Classes.csproj" -c "Release" | |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\DFe.Utils\DFe.Utils.csproj" -c "Release" | |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\DFe.Wsdl\DFe.Wsdl.csproj" -c "Release" | |
- name: Build/Restore NFe | |
run: | | |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\NFe.Classes\NFe.Classes.csproj" -c "Release" | |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\NFe.Servicos\NFe.Servicos.csproj" -c "Release" | |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\NFe.Utils\NFe.Utils.csproj" -c "Release" | |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\NFe.Wsdl\NFe.Wsdl.csproj" -c "Release" | |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\NFe.Wsdl.Standard\NFe.Wsdl.Standard.csproj" -c "Release" | |
- name: Build/Restore MDFe | |
run: | | |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\MDFe.Classes\MDFe.Classes.csproj" -c "Release" | |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\MDFe.Servicos\MDFe.Servicos.csproj" -c "Release" | |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\MDFe.Utils\MDFe.Utils.csproj" -c "Release" | |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\MDFe.Wsdl\MDFe.Wsdl.csproj" -c "Release" | |
- name: Build/Restore MDFe | |
run: | | |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\CTe.Classes\CTe.Classes.csproj" -c "Release" | |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\CTe.Servicos\CTe.Servicos.csproj" -c "Release" | |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\CTe.Utils\CTe.Utils.csproj" -c "Release" | |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\CTe.Wsdl\CTe.Wsdl.csproj" -c "Release" | |
#- name: Test | |
# run: dotnet test --no-build --verbosity normal | |
- name: Organizar arquivos de artefatos | |
run: | | |
mkdir -p CTeArtefato | |
mkdir -p MdfeArtefato | |
mkdir -p NfeArtefato | |
# Organizar arquivos para NFeArtefato | |
cp NuGet/Zeus.Net.NFe.NFCe/Zeus.Net.NFe.NFCe.nuspec NfeArtefato/ | |
cp ${{ github.workspace }}/*.nupkg NfeArtefato/ | |
mkdir -p NfeArtefato/lib/net40 | |
cp NFe.Wsdl/bin/Release/net40/NFe.Wsdl.dll NfeArtefato/lib/net40/ | |
cp NFe.Utils/bin/Release/net40/NFe.Utils.dll NfeArtefato/lib/net40/ | |
cp NFe.Servicos/bin/Release/net40/NFe.Servicos.dll NfeArtefato/lib/net40/ | |
cp NFe.Classes/bin/Release/net40/NFe.Classes.dll NfeArtefato/lib/net40/ | |
cp DFe.Classes/bin/Release/net40/DFe.Classes.dll NfeArtefato/lib/net40/ | |
# Organizar arquivos para MDFeArtefato | |
cp NuGet/Zeus.Net.MDFe/Zeus.Net.MDFe.nuspec MdfeArtefato/ | |
cp ${{ github.workspace }}/*.nupkg MdfeArtefato/ | |
mkdir -p MdfeArtefato/lib/net40 | |
cp MDFe.Wsdl/bin/Release/net40/MDFe.Wsdl.dll MdfeArtefato/lib/net40/ | |
cp MDFe.Utils/bin/Release/net40/MDFe.Utils.dll MdfeArtefato/lib/net40/ | |
cp MDFe.Servicos/bin/Release/net40/MDFe.Servicos.dll MdfeArtefato/lib/net40/ | |
cp MDFe.Classes/bin/Release/net40/MDFe.Classes.dll MdfeArtefato/lib/net40/ | |
cp DFe.Classes/bin/Release/net40/DFe.Classes.dll MdfeArtefato/lib/net40/ | |
# Organizar arquivos para CTeArtefato | |
cp NuGet/Zeus.Net.CTe/Zeus.Net.CTe.nuspec CTeArtefato/ | |
cp ${{ github.workspace }}/*.nupkg CTeArtefato/ | |
mkdir -p CTeArtefato/lib/net40 | |
cp CTe.Wsdl/bin/Release/net40/CTe.Wsdl.dll CTeArtefato/lib/net40/ | |
cp CTe.Utils/bin/Release/net40/CTe.Utils.dll CTeArtefato/lib/net40/ | |
cp CTe.Servicos/bin/Release/net40/CTe.Servicos.dll CTeArtefato/lib/net40/ | |
cp CTe.Classes/bin/Release/net40/CTe.Classes.dll CTeArtefato/lib/net40/ | |
cp DFe.Classes/bin/Release/net40/DFe.Classes.dll CTeArtefato/lib/net40/ | |
- name: Packe e compactar artefatos | |
run: | | |
dotnet pack -o ${{ github.workspace }} -v minimal -c Release -p:NuspecProperties=version=${{ steps.date.outputs.date }} -p:PackageVersion=${{ steps.date.outputs.date }} NuGet\Zeus.Net.NFe.NFCe\Zeus.Net.NFe.NFCe.csproj | |
dotnet pack -o ${{ github.workspace }} -v minimal -c Release -p:NuspecProperties=version=${{ steps.date.outputs.date }} -p:PackageVersion=${{ steps.date.outputs.date }} NuGet\Zeus.Net.MDFe\Zeus.Net.MDFe.csproj | |
dotnet pack -o ${{ github.workspace }} -v minimal -c Release -p:NuspecProperties=version=${{ steps.date.outputs.date }} -p:PackageVersion=${{ steps.date.outputs.date }} NuGet\Zeus.Net.CTe\Zeus.Net.CTe.csproj | |
Compress-Archive -Path ./CTeArtefato -DestinationPath ${{ github.workspace }}/CTeArtefato.zip | |
Compress-Archive -Path ./MdfeArtefato -DestinationPath ${{ github.workspace }}/MdfeArtefato.zip | |
Compress-Archive -Path ./NfeArtefato -DestinationPath ${{ github.workspace }}/NfeArtefato.zip | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nupkg | |
path: ${{ github.workspace }}/*.nupkg | |
- name: Upload ZIP Files as Assets | |
uses: actions/upload-artifact@v4 | |
with: | |
name: zip-artefatos | |
path: ${{ github.workspace }}/*.zip | |
deploy: | |
needs: build | |
if: github.event_name == 'push' || github.event.inputs.nugetdeploy == 'true' | |
runs-on: ${{ 'ubuntu-latest' }} | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: nupkg | |
path: ${{ github.workspace }} | |
- name: List Artifacts | |
run: dir | |
- name: Setup Nuget | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: 6.0.x | |
- name: Push to NuGet Feed | |
run: dotnet nuget push *.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json | |
env: | |
NUGET_AUTH_TOKEN: ${{secrets.NUGET_SECRET_DEPLOY}} | |
- name: Criar Tag | |
id: create_tag | |
run: | | |
curl -X POST \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Content-Type: application/json" \ | |
-d '{ | |
"tag": "${{ needs.build.outputs.version }}", | |
"message": "Release versão ${{ needs.build.outputs.version }}", | |
"object": "${{ github.sha }}", | |
"type": "commit" | |
}' \ | |
https://api.github.com/repos/${{ github.repository }}/git/tags | |
- name: Criar Release | |
id: create_release | |
run: | | |
curl -X POST \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Content-Type: application/json" \ | |
-d '{ | |
"tag_name": "${{ needs.build.outputs.version }}", | |
"name": "${{ needs.build.outputs.version }}", | |
"body": "Esta é a release da versão ${{ needs.build.outputs.version }} do Zeus DFe.NET.", | |
"draft": false, | |
"prerelease": false | |
}' \ | |
https://api.github.com/repos/${{ github.repository }}/releases | |
- name: Attach ZIP Files as Assets to Release | |
run: | | |
curl -X POST \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-F "file=@${{ github.workspace }}/CteArtefato.zip" \ | |
-F "file=@${{ github.workspace }}/MdfeArtefato.zip" \ | |
-F "file=@${{ github.workspace }}/NfeArtefato.zip" \ | |
-F "file=@${{ github.workspace }}/*.nupkg" \ | |
https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.create_release.outputs.id }}/assets?name=CteArtefato.zip | |
- name: Discord notification | |
continue-on-error: true | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
DISCORD_MENSAGEM: ${{ needs.build.outputs.version }} | |
uses: Ilshidur/action-discord@master | |
with: | |
args: 'Lançado Zeus DFe.NET versão {{ DISCORD_MENSAGEM }} no Nuget! Acesse: https://www.nuget.org/profiles/ZeusAutomacao' |