Skip to content

Commit 61fec67

Browse files
authored
Merge pull request #6 from oleksis/gh-release-action
2 parents e8404b2 + 5b3d063 commit 61fec67

File tree

2 files changed

+80
-5
lines changed

2 files changed

+80
-5
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Release Artifacts
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
defaults:
9+
run:
10+
shell: powershell
11+
12+
jobs:
13+
build:
14+
runs-on: windows-latest
15+
permissions: write-all
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v3
20+
21+
- name: Convert tag to version
22+
id: convert_tag
23+
run: |
24+
$version = "${{ github.ref }}"
25+
$version = $version -replace '^refs/tags/v', ''
26+
echo "version=$version" >> "$env:GITHUB_ENV"
27+
echo "version=$version"
28+
29+
- name: Set up PowerShell
30+
run: |
31+
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
32+
33+
- name: Install ps2exe module
34+
run: |
35+
Install-Module -Name ps2exe -Scope CurrentUser -Force
36+
37+
- name: Compile and release scripts
38+
run: |
39+
echo "Compile version ${{ env.version }}"
40+
Get-ChildItem -Path . -Filter *.ps1 -Recurse | ForEach-Object {
41+
Invoke-ps2exe -inputFile $_.Name -version ${{ env.version }}
42+
}
43+
44+
- name: Create Release
45+
run: |
46+
gh release create v${{ env.version }} -t v${{ env.version }} -n "Release v${{ env.version }}" --draft=false --prerelease=false
47+
env:
48+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
50+
- name: Upload executable files
51+
run: |
52+
Get-ChildItem -Path . -Filter *.exe -Recurse | ForEach-Object {
53+
$fileName = $_.Name
54+
$hash = Get-FileHash -Path $_.Name -Algorithm SHA256
55+
$hashLine = "$($hash.Hash.ToLower()) $fileName"
56+
Add-Content -Path "SHA2-256SUMS" -Value $hashLine
57+
gh release upload v${{ env.version }} $fileName --clobber
58+
}
59+
gh release upload v${{ env.version }} SHA2-256SUMS --clobber
60+
env:
61+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

list-wsl.ps1

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,26 @@ $defaultGuid = (Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\Current
33
$wslDistributions = Get-ChildItem -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss" | ForEach-Object {
44
$distribution = @{}
55
$distribution["Name"] = $_.GetValue("DistributionName")
6+
$distribution["State"] = "Installed"
7+
$distribution["WSL"] = 2
8+
$distribution["systemd"] = "Disabled"
9+
$distribution["Default User"] = ""
10+
$distribution["Distro Version"] = ""
11+
$distribution["Linux Distro"] = ""
612

7-
if ($distribution["Name"] -eq "docker-desktop") { $distribution["Linux Distro"] = "Docker Desktop"; $distribution["State"] = "Installed"; $distribution["WSL"] = 2; $distribution["systemd"] = "Disabled"; $distribution["Default User"] = ""; $distribution["Distro Version"] = "" }
8-
if ($distribution["Name"] -eq "docker-desktop-data") { $distribution["Linux Distro"] = "Docker Desktop Data"; $distribution["State"] = "Installed"; $distribution["WSL"] = 2; $distribution["systemd"] = "Disabled"; $distribution["Default User"] = ""; $distribution["Distro Version"] = "" }
9-
if ($distribution["Name"] -eq "docker-desktop-runtime") { $distribution["Linux Distro"] = "Docker Desktop Runtime"; $distribution["State"] = "Installed"; $distribution["WSL"] = 2; $distribution["systemd"] = "Disabled"; $distribution["Default User"] = ""; $distribution["Distro Version"] = "" }
10-
if ($distribution["Name"] -eq "rancher-desktop") { $distribution["Linux Distro"] = "Rancher Desktop WSL Distribution"; $distribution["State"] = "Installed"; $distribution["WSL"] = 2; $distribution["systemd"] = "Disabled"; $distribution["Default User"] = ""; $distribution["Distro Version"] = "" }
11-
if ($distribution["Name"] -eq "rancher-desktop-data") { $distribution["Linux Distro"] = "Rancher Desktop Data"; $distribution["State"] = "Installed"; $distribution["WSL"] = 2; $distribution["systemd"] = "Disabled"; $distribution["Default User"] = ""; $distribution["Distro Version"] = "" }
13+
if ($distribution["Name"] -eq "docker-desktop") {
14+
$distribution["Linux Distro"] = "Docker Desktop"
15+
} elseif ($distribution["Name"] -eq "docker-desktop-data") {
16+
$distribution["Linux Distro"] = "Docker Desktop Data"
17+
} elseif ($distribution["Name"] -eq "docker-desktop-runtime") {
18+
$distribution["Linux Distro"] = "Docker Desktop Runtime"
19+
} elseif ($distribution["Name"] -eq "rancher-desktop") {
20+
$distribution["Linux Distro"] = "Rancher Desktop WSL Distribution"
21+
} elseif ($distribution["Name"] -eq "rancher-desktop-data") {
22+
$distribution["Linux Distro"] = "Rancher Desktop Data"
23+
} else {
24+
$distribution["State"] = ""
25+
}
1226

1327
if ($distribution["Name"] -ne "docker-desktop" -and $distribution["Name"] -ne "docker-desktop-data" -and $distribution["Name"] -ne "docker-desktop-runtime" -and $distribution["Name"] -ne "rancher-desktop" -and $distribution["Name"] -ne "rancher-desktop-data") {
1428
$osRelease = Invoke-Expression "wsl.exe -d $($distribution["Name"]) cat /etc/os-release"

0 commit comments

Comments
 (0)