Upload release file #24
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: Upload release file | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| upload_url: | |
| description: "Upload URL" | |
| required: true | |
| zipfilename: | |
| description: "Name of the ZIP file" | |
| required: true | |
| versiontag: | |
| description: "Tag of the release" | |
| required: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build and upload module | |
| runs-on: windows-latest | |
| env: | |
| upload_url: ${{ github.event.inputs.upload_url }} | |
| zipfilename: ${{ github.event.inputs.zipfilename }} | |
| versiontag: ${{ github.event.inputs.versiontag }} | |
| configuration: "release" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: "refs/tags/${{ env.versiontag }}" | |
| - name: Setup dotnet | |
| uses: actions/setup-dotnet@v3 | |
| with: | |
| dotnet-version: '8.0.x' | |
| - name: Install dependencies TameMyCerts | |
| run: dotnet restore TameMyCerts\TameMyCerts.csproj | |
| - name: Install dependencies Support.GenerateETWManifest | |
| run: dotnet restore Support.GenerateETWManifest\Support.GenerateETWManifest.csproj | |
| - name: Setup MSBuild Path | |
| uses: microsoft/[email protected] | |
| env: | |
| ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
| - name: Build Debug | |
| run: msbuild TameMyCerts\TameMyCerts.csproj -property:Configuration=${{ env.configuration }} -p:OutDir=..\release | |
| - name: Build ETW Manifest | |
| run: msbuild Support.GenerateETWManifest\Support.GenerateETWManifest.csproj -property:Configuration=${{ env.configuration }} -p:OutDir=..\releaseETW | |
| - name: Copy files | |
| run: | | |
| Copy-Item -Recurse -PassThru .\examples .\release | |
| Copy-Item -Recurse -PassThru .\LICENSE .\release | |
| Copy-Item -Recurse -PassThru .\README.md .\release | |
| Copy-Item -PassThru .\releaseETW\TameMyCerts.Events.dll .\release | |
| Copy-Item -PassThru .\releaseETW\TameMyCerts.Events.man .\release | |
| shell: pwsh | |
| - name: Create ZIP file | |
| run: | | |
| Add-Type -AssemblyName 'System.IO.Compression.FileSystem' | |
| [System.IO.Compression.ZipFile]::CreateFromDirectory("release", "release.zip", [System.IO.Compression.CompressionLevel]::SmallestSize, $false) | |
| Write-Host "ZIP file created successfully at $zipFilePath" | |
| shell: pwsh | |
| - name: Upload Release Assets | |
| id: upload-release-asset | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ env.upload_url }} | |
| asset_path: release.zip | |
| asset_name: ${{ env.zipfilename }} | |
| asset_content_type: application/zip |