Skip to content

Merge pull request #95 from hhunterx/master #154

Merge pull request #95 from hhunterx/master

Merge pull request #95 from hhunterx/master #154

name: ZeusFiscal_build
permissions:
contents: write # necessário para criar releases
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: [windows-2022]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setando Versão
id: date
run: |
$date = Get-Date -Format "yyyy.MM.dd.HHmm"
echo "date=$date" >> $env:GITHUB_OUTPUT
- name: Mostrar Versão
run: echo ${{ steps.date.outputs.date }}
- name: Setup .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
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 CTe
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: Build Impressão QuestPDF
run: |
dotnet build -p:Version=${{ steps.date.outputs.date }} ".\NFe.Danfe.QuestPdf\NFe.Danfe.QuestPdf.csproj" -c Release
#- name: Test
# run: dotnet test --no-build --verbosity normal
- name: Pack NuGets
run: |
dotnet pack -o ${{ github.workspace }} -v minimal -c Release -p:NuspecProperties=version=${{ steps.date.outputs.date }} -p:PackageVersion=${{ steps.date.outputs.date }} NuGet\Hercules.NET.NFe.NFCe\Hercules.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\Hercules.NET.MDFe\Hercules.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\Hercules.NET.CTe\Hercules.NET.CTe.csproj
dotnet pack -o ${{ github.workspace }} -v minimal -c Release -p:NuspecProperties=version=${{ steps.date.outputs.date }} -p:PackageVersion=${{ steps.date.outputs.date }} NuGet\Hercules.NET.Impressao.NFCe.QuestPdf\Hercules.NET.Impressao.NFCe.QuestPdf.csproj
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: nupkg
path: ${{ github.workspace }}/*.nupkg
deploy:
needs: build
if: github.event_name == 'push' || github.event.inputs.nugetdeploy == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4 #usado para etapa de pegar commits para gerar texto release
- 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@v4
with:
dotnet-version: 9.0.x
- name: Push to NuGet Feed
working-directory: ${{ github.workspace }}
run: dotnet nuget push *.nupkg --source "https://api.nuget.org/v3/index.json" --api-key ${{ secrets.NUGET_AUTH_TOKEN }}
env:
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_AUTH_TOKEN }}
- name: Generate Release Notes
id: release_notes
run: |
git fetch --tags
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ || echo "")
if [ -z "$PREV_TAG" ]; then
echo "notes=$(git log --oneline)" >> $GITHUB_OUTPUT
else
echo "notes=$(git log --oneline $PREV_TAG..HEAD)" >> $GITHUB_OUTPUT
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.build.outputs.version }}
name: "Release ${{ needs.build.outputs.version }}"
body: |
🚀 Nova versão Hercules/ZeusFiscal publicada: **${{ needs.build.outputs.version }}**
### Commits desde a última versão:
${{ steps.release_notes.outputs.notes }}
### Pacotes NuGet publicados:
- Hercules.NET.NFe.NFCe
- Hercules.NET.MDFe
- Hercules.NET.CTe
- Hercules.NET.Impressao.NFCe.QuestPdf
files: |
${{ github.workspace }}/*.nupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Discord notification
continue-on-error: true
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_MENSAGEM: "🚀 Lançado Hercules.NET/ZeusFiscal versão ${{ needs.build.outputs.version }} no NuGet!\n\nVeja a release: https://github.com/${{ github.repository }}/releases/tag/${{ needs.build.outputs.version }}"
uses: Ilshidur/action-discord@master
with:
args: '{{ DISCORD_MENSAGEM }}'