|
| 1 | +name: Release |
| 2 | + |
| 3 | +# Automates the "Publishing a Release with VeloPack" steps from CONTRIBUTING.md: publish + |
| 4 | +# `vpk pack` per architecture, assemble Dist/, and attach everything to a GitHub Release. |
| 5 | +# Triggered by pushing a tag like V1.9.1 (matching the tag format vpk/CONTRIBUTING.md already use). |
| 6 | +on: |
| 7 | + push: |
| 8 | + tags: ['V*'] |
| 9 | + workflow_dispatch: |
| 10 | + inputs: |
| 11 | + version: |
| 12 | + description: 'Version to release (e.g. 1.9.1) — required for manual runs' |
| 13 | + required: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + package: |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + include: |
| 20 | + - platform: x64 |
| 21 | + rid: win-x64 |
| 22 | + channel: win-x64 |
| 23 | + runner: windows-latest |
| 24 | + - platform: ARM64 |
| 25 | + rid: win-arm64 |
| 26 | + channel: win-arm64 |
| 27 | + runner: windows-11-arm |
| 28 | + |
| 29 | + runs-on: ${{ matrix.runner }} |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout |
| 33 | + uses: actions/checkout@v5 |
| 34 | + |
| 35 | + - name: Setup .NET |
| 36 | + uses: actions/setup-dotnet@v5 |
| 37 | + with: |
| 38 | + dotnet-version: 8.0.x |
| 39 | + |
| 40 | + - name: Determine version |
| 41 | + id: version |
| 42 | + shell: pwsh |
| 43 | + run: | |
| 44 | + $version = "${{ inputs.version }}" |
| 45 | + if (-not $version) { $version = "${{ github.ref_name }}".TrimStart('V') } |
| 46 | + "version=$version" >> $env:GITHUB_OUTPUT |
| 47 | +
|
| 48 | + - name: Install VeloPack CLI |
| 49 | + run: dotnet tool install -g vpk |
| 50 | + |
| 51 | + - name: Publish |
| 52 | + run: > |
| 53 | + dotnet publish |
| 54 | + -c Release |
| 55 | + -r ${{ matrix.rid }} |
| 56 | + --self-contained |
| 57 | + -p:Platform=${{ matrix.platform }} |
| 58 | +
|
| 59 | + - name: vpk pack |
| 60 | + run: > |
| 61 | + vpk pack |
| 62 | + -u FluentTaskScheduler |
| 63 | + -v ${{ steps.version.outputs.version }} |
| 64 | + -c ${{ matrix.channel }} |
| 65 | + -o Releases/${{ matrix.platform }} |
| 66 | + -p bin/${{ matrix.platform }}/Release/net8.0-windows10.0.19041.0/${{ matrix.rid }}/publish |
| 67 | + -e FluentTaskScheduler.exe |
| 68 | + --msi --instLocation Either |
| 69 | + --msiBanner Assets/MSI-Banner.bmp |
| 70 | + --msiLogo Assets/MSI-Logo.bmp |
| 71 | +
|
| 72 | + - name: Fix zero-dated Portable ZIP entries |
| 73 | + shell: pwsh |
| 74 | + run: | |
| 75 | + Add-Type -Assembly System.IO.Compression.FileSystem |
| 76 | + $now = Get-Date |
| 77 | + $zip = "Releases/${{ matrix.platform }}/FluentTaskScheduler-${{ matrix.rid }}-Portable.zip" |
| 78 | + $archive = [System.IO.Compression.ZipFile]::Open($zip, 'Update') |
| 79 | + foreach ($entry in $archive.Entries) { $entry.LastWriteTime = $now } |
| 80 | + $archive.Dispose() |
| 81 | +
|
| 82 | + - name: Assemble Dist |
| 83 | + shell: pwsh |
| 84 | + run: | |
| 85 | + New-Item -ItemType Directory -Force -Path Dist | Out-Null |
| 86 | + $v = "${{ steps.version.outputs.version }}" |
| 87 | + Copy-Item "Releases/${{ matrix.platform }}/FluentTaskScheduler-${{ matrix.rid }}-Portable.zip" "Dist/Portable-${{ matrix.platform }}.zip" -Force |
| 88 | + Copy-Item "Releases/${{ matrix.platform }}/FluentTaskScheduler-${{ matrix.rid }}.msi" "Dist/Setup-${{ matrix.platform }}.msi" -Force |
| 89 | + Copy-Item "Releases/${{ matrix.platform }}/releases.${{ matrix.channel }}.json" "Dist/" -Force |
| 90 | + Copy-Item "Releases/${{ matrix.platform }}/FluentTaskScheduler-$v-full.nupkg" "Dist/" -Force |
| 91 | + Get-Item "Releases/${{ matrix.platform }}/FluentTaskScheduler-$v-delta.nupkg" -ErrorAction SilentlyContinue | Copy-Item -Destination "Dist/" -Force |
| 92 | +
|
| 93 | + - name: Upload Dist artifact |
| 94 | + uses: actions/upload-artifact@v5 |
| 95 | + with: |
| 96 | + name: Dist-${{ matrix.platform }} |
| 97 | + path: Dist/ |
| 98 | + |
| 99 | + publish-release: |
| 100 | + needs: package |
| 101 | + runs-on: ubuntu-latest |
| 102 | + steps: |
| 103 | + - name: Download all Dist artifacts |
| 104 | + uses: actions/download-artifact@v6 |
| 105 | + with: |
| 106 | + pattern: Dist-* |
| 107 | + path: Dist |
| 108 | + merge-multiple: true |
| 109 | + |
| 110 | + - name: Create GitHub Release |
| 111 | + uses: softprops/action-gh-release@v2 |
| 112 | + with: |
| 113 | + files: Dist/* |
| 114 | + draft: true |
| 115 | + generate_release_notes: true |
0 commit comments