Skip to content

Commit

Permalink
Merge pull request #6 from oleksis/gh-release-action
Browse files Browse the repository at this point in the history
  • Loading branch information
sirredbeard authored Jun 20, 2023
2 parents e8404b2 + 5b3d063 commit 61fec67
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 5 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/release-artifacts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Release Artifacts

on:
push:
tags:
- "v*"

defaults:
run:
shell: powershell

jobs:
build:
runs-on: windows-latest
permissions: write-all

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Convert tag to version
id: convert_tag
run: |
$version = "${{ github.ref }}"
$version = $version -replace '^refs/tags/v', ''
echo "version=$version" >> "$env:GITHUB_ENV"
echo "version=$version"
- name: Set up PowerShell
run: |
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process -Force
- name: Install ps2exe module
run: |
Install-Module -Name ps2exe -Scope CurrentUser -Force
- name: Compile and release scripts
run: |
echo "Compile version ${{ env.version }}"
Get-ChildItem -Path . -Filter *.ps1 -Recurse | ForEach-Object {
Invoke-ps2exe -inputFile $_.Name -version ${{ env.version }}
}
- name: Create Release
run: |
gh release create v${{ env.version }} -t v${{ env.version }} -n "Release v${{ env.version }}" --draft=false --prerelease=false
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload executable files
run: |
Get-ChildItem -Path . -Filter *.exe -Recurse | ForEach-Object {
$fileName = $_.Name
$hash = Get-FileHash -Path $_.Name -Algorithm SHA256
$hashLine = "$($hash.Hash.ToLower()) $fileName"
Add-Content -Path "SHA2-256SUMS" -Value $hashLine
gh release upload v${{ env.version }} $fileName --clobber
}
gh release upload v${{ env.version }} SHA2-256SUMS --clobber
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24 changes: 19 additions & 5 deletions list-wsl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,26 @@ $defaultGuid = (Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\Current
$wslDistributions = Get-ChildItem -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Lxss" | ForEach-Object {
$distribution = @{}
$distribution["Name"] = $_.GetValue("DistributionName")
$distribution["State"] = "Installed"
$distribution["WSL"] = 2
$distribution["systemd"] = "Disabled"
$distribution["Default User"] = ""
$distribution["Distro Version"] = ""
$distribution["Linux Distro"] = ""

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"] = "" }
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"] = "" }
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"] = "" }
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"] = "" }
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"] = "" }
if ($distribution["Name"] -eq "docker-desktop") {
$distribution["Linux Distro"] = "Docker Desktop"
} elseif ($distribution["Name"] -eq "docker-desktop-data") {
$distribution["Linux Distro"] = "Docker Desktop Data"
} elseif ($distribution["Name"] -eq "docker-desktop-runtime") {
$distribution["Linux Distro"] = "Docker Desktop Runtime"
} elseif ($distribution["Name"] -eq "rancher-desktop") {
$distribution["Linux Distro"] = "Rancher Desktop WSL Distribution"
} elseif ($distribution["Name"] -eq "rancher-desktop-data") {
$distribution["Linux Distro"] = "Rancher Desktop Data"
} else {
$distribution["State"] = ""
}

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") {
$osRelease = Invoke-Expression "wsl.exe -d $($distribution["Name"]) cat /etc/os-release"
Expand Down

0 comments on commit 61fec67

Please sign in to comment.