Publish #6
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 | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build-windows: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Build test apps (Client + Upgrade) | |
| run: | | |
| dotnet publish test_app/Client/ClientSample.csproj -c Release -r win-x64 -p:PublishSingleFile=true --self-contained -o prebuilt | |
| dotnet publish test_app/Upgrade/UpgradeSample.csproj -c Release -r win-x64 -p:PublishSingleFile=true --self-contained -o prebuilt | |
| - name: Publish Tools | |
| run: > | |
| dotnet publish src/GeneralUpdate.Tools.csproj | |
| -c Release -r win-x64 | |
| -p:PublishSingleFile=true --self-contained | |
| -p:IncludeNativeLibrariesForSelfExtract=true | |
| -p:IncludeAllContentForSelfExtract=true | |
| -o publish/win-x64 | |
| - name: Copy test apps into publish output | |
| run: xcopy prebuilt\* publish\win-x64\test_app_exe\ /Y /I | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: win-x64 | |
| path: publish/win-x64/ | |
| build-linux: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Build test apps (Client + Upgrade) | |
| run: | | |
| dotnet publish test_app/Client/ClientSample.csproj -c Release -r linux-x64 -p:PublishSingleFile=true --self-contained -o prebuilt | |
| dotnet publish test_app/Upgrade/UpgradeSample.csproj -c Release -r linux-x64 -p:PublishSingleFile=true --self-contained -o prebuilt | |
| - name: Publish Tools | |
| run: > | |
| dotnet publish src/GeneralUpdate.Tools.csproj | |
| -c Release -r linux-x64 | |
| -p:PublishSingleFile=true --self-contained | |
| -p:IncludeNativeLibrariesForSelfExtract=true | |
| -p:IncludeAllContentForSelfExtract=true | |
| -o publish/linux-x64 | |
| - name: Copy test apps into publish output | |
| run: mkdir -p publish/linux-x64/test_app_exe && cp prebuilt/* publish/linux-x64/test_app_exe/ | |
| - name: Upload | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-x64 | |
| path: publish/linux-x64/ | |
| release: | |
| needs: [build-windows, build-linux] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| - name: Get timestamp | |
| id: ts | |
| run: echo "timestamp=$(date -u '+%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT | |
| - name: Package win | |
| working-directory: win-x64 | |
| run: zip ../GeneralUpdate.Tools_${{ steps.ts.outputs.timestamp }}_win-x64.zip -r * | |
| - name: Package linux | |
| working-directory: linux-x64 | |
| run: | | |
| chmod +x * | |
| zip ../GeneralUpdate.Tools_${{ steps.ts.outputs.timestamp }}_linux-x64.zip -r * | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.ts.outputs.timestamp }} | |
| name: GeneralUpdate.Tools ${{ steps.ts.outputs.timestamp }} | |
| files: | | |
| GeneralUpdate.Tools_${{ steps.ts.outputs.timestamp }}_win-x64.zip | |
| GeneralUpdate.Tools_${{ steps.ts.outputs.timestamp }}_linux-x64.zip |