Update documentation for Issue #12 package list management features #93
Workflow file for this run
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: Create Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout with submodules | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Create release ZIP | |
| shell: pwsh | |
| run: | | |
| $version = "${{ github.ref_name }}" | |
| $tempPath = Join-Path ([System.IO.Path]::GetTempPath()) "SandboxStart-$version-temp" | |
| if (Test-Path $tempPath) { | |
| Remove-Item $tempPath -Recurse -Force | |
| } | |
| New-Item -ItemType Directory -Path $tempPath -Force | Out-Null | |
| # Create SandboxStart subfolder inside temp directory | |
| $releaseFolder = Join-Path $tempPath "SandboxStart" | |
| New-Item -ItemType Directory -Path $releaseFolder -Force | Out-Null | |
| # Copy PowerShell scripts from Source/ to SandboxStart folder | |
| $scriptsFromSource = @( | |
| 'SandboxStart.ps1', | |
| 'Test-WindowsSandbox.ps1', | |
| 'Update-StartMenuShortcut.ps1', | |
| 'startmenu-icon.ico' | |
| ) | |
| foreach ($script in $scriptsFromSource) { | |
| $sourcePath = Join-Path "Source" $script | |
| if (Test-Path $sourcePath) { | |
| Copy-Item $sourcePath -Destination $releaseFolder -Force | |
| } | |
| } | |
| # Copy README from root | |
| if (Test-Path "README.md") { | |
| Copy-Item "README.md" -Destination $releaseFolder -Force | |
| } | |
| # Copy shared submodule to shared/ in SandboxStart folder | |
| $sharedDest = Join-Path $releaseFolder "shared" | |
| New-Item -ItemType Directory -Path $sharedDest -Force | Out-Null | |
| Copy-Item "Source\shared\Shared-Helpers.ps1" -Destination $sharedDest -Force | |
| Copy-Item "Source\shared\SandboxTest.ps1" -Destination $sharedDest -Force | |
| Copy-Item "Source\shared\Show-SandboxTestDialog.ps1" -Destination $sharedDest -Force | |
| if (Test-Path "LICENSE") { | |
| Copy-Item "LICENSE" -Destination $releaseFolder -Force | |
| } | |
| Compress-Archive -Path "$tempPath\*" -DestinationPath "SandboxStart-$version.zip" -Force | |
| Remove-Item $tempPath -Recurse -Force | |
| - name: Create or Update Release | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const tag = context.ref.replace('refs/tags/', ''); | |
| let existingBody = ''; | |
| try { | |
| const { data: release } = await github.rest.repos.getReleaseByTag({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| tag: tag | |
| }); | |
| existingBody = release.body || ''; | |
| } catch (error) { | |
| console.log('No existing release found'); | |
| } | |
| const header = '**📦 Download:** `SandboxStart-' + tag + '.zip` (all dependencies included)\n\n---\n\n'; | |
| const fullBody = header + existingBody; | |
| try { | |
| const { data: release } = await github.rest.repos.getReleaseByTag({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| tag: tag | |
| }); | |
| await github.rest.repos.updateRelease({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| release_id: release.id, | |
| body: fullBody | |
| }); | |
| const zipPath = 'SandboxStart-' + tag + '.zip'; | |
| const zipContent = fs.readFileSync(zipPath); | |
| for (const asset of release.assets) { | |
| if (asset.name === 'SandboxStart-' + tag + '.zip') { | |
| await github.rest.repos.deleteReleaseAsset({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| asset_id: asset.id | |
| }); | |
| } | |
| } | |
| await github.rest.repos.uploadReleaseAsset({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| release_id: release.id, | |
| name: 'SandboxStart-' + tag + '.zip', | |
| data: zipContent | |
| }); | |
| } catch (error) { | |
| const { data: newRelease } = await github.rest.repos.createRelease({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| tag_name: tag, | |
| name: tag, | |
| body: fullBody, | |
| draft: false, | |
| prerelease: false | |
| }); | |
| const zipPath = 'SandboxStart-' + tag + '.zip'; | |
| const zipContent = fs.readFileSync(zipPath); | |
| await github.rest.repos.uploadReleaseAsset({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| release_id: newRelease.id, | |
| name: 'SandboxStart-' + tag + '.zip', | |
| data: zipContent | |
| }); | |
| } |