Publish NuGet Package #48
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
| name: Publish NuGet Package | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Step 1: Check out the repository | |
| - name: Checkout Repository | |
| uses: actions/checkout@v3 | |
| with: | |
| submodules: true | |
| fetch-depth: 0 | |
| # Step 2: Set up .NET | |
| - name: Set Up .NET | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: '7.0' | |
| # Step 3: Generate Version | |
| - name: Generate Version | |
| id: generate_version | |
| run: | | |
| major=1 | |
| minor=0 | |
| build=$(date +'%Y%m%d') | |
| revision=$(date +'%H%M') | |
| version="$major.$minor.$build.$revision" | |
| echo "version=$version" >> $GITHUB_ENV | |
| # Step 4: Prepare Files | |
| - name: Prepare Files | |
| run: | | |
| mkdir -p Scripts-PowerShell | |
| cp LICENSE README.md Scripts-PowerShell/ | |
| for dir in */ ; do | |
| dir=${dir%/} | |
| if [[ "$dir" != "Scripts-PowerShell" && "$dir" != ".github" ]]; then | |
| mkdir -p Scripts-PowerShell/"$dir" | |
| cp -r "$dir"/* Scripts-PowerShell/"$dir"/ || echo "Skipping $dir" | |
| fi | |
| done | |
| # Step 5: Create Project File | |
| - name: Create Project File | |
| run: | | |
| echo "Creating nuget.package.csproj..." | |
| cat > nuget.package.csproj <<- 'EOF' | |
| <Project Sdk="Microsoft.NET.Sdk"> | |
| <PropertyGroup> | |
| <TargetFramework>net7.0</TargetFramework> | |
| <PackageId>Scripts-PowerShell</PackageId> | |
| <Authors>Luiz Hamilton Silva</Authors> | |
| <Company>Brazilianscriptguy</Company> | |
| <Product>Scripts-PowerShell</Product> | |
| <Description> | |
| Comprehensive suite of PowerShell and VBScript tools automates Active Directory tasks, advances forensic analysis, | |
| and simplifies script creation. Designed for managing Windows Servers and workstations, these tools ensure accuracy, | |
| efficiency, scalability, and adaptability. | |
| </Description> | |
| <PackageTags>PowerShell;Automation;SysAdmin;ActiveDirectory;Forensics</PackageTags> | |
| <RepositoryUrl>https://github.com/brazilianscriptguy/Windows-SysAdmin-ProSuite</RepositoryUrl> | |
| <Version>${{ env.version }}</Version> | |
| <GenerateAssemblyInfo>false</GenerateAssemblyInfo> | |
| <NoBuild>tru |