Added release workflow & removed githook
This commit is contained in:
54
.github/workflows/releaser.yml
vendored
Normal file
54
.github/workflows/releaser.yml
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
$pattern = "version: (.*?) \#"
|
||||
$string = Get-Content pubspec.yaml
|
||||
$wsl2_manager_version = [regex]::match($string, $pattern).Groups[1].Value
|
||||
Compress-Archive -Path ./build/windows/runner/Release/* -DestinationPath .\wsl2-distro-manager-v$wsl2_manager_version.zip
|
||||
Write-Output 'gh release create v$wsl2_manager_version ./build/windows/runner/Release/wsl2-distro-manager-v$wsl2_manager_version.zip --notes "This is an automated release."'
|
||||
|
||||
name: Releaser
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
# get version from pubspec.yaml
|
||||
- name: Get version
|
||||
id: get_version
|
||||
run: |
|
||||
$pattern = "version: (.*?) \#"
|
||||
$string = Get-Content pubspec.yaml
|
||||
$wsl2_manager_version = [regex]::match($string, $pattern).Groups[1].Value
|
||||
Write-Output "::set-output name=version::$wsl2_manager_version"
|
||||
# check if release already exists
|
||||
- uses: cardinalby/git-get-release-action@v1
|
||||
name: Check if release exists
|
||||
id: check_release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
with:
|
||||
tag: v${{ steps.get_version.outputs.version }}
|
||||
# if check_release step fails build
|
||||
- uses: subosito/flutter-action@v2
|
||||
if: ${{ steps.check_release.outcome == 'failure' }}
|
||||
with:
|
||||
channel: 'stable'
|
||||
- run: flutter config --enable-windows-desktop
|
||||
if: ${{ steps.check_release.outcome == 'failure' }}
|
||||
- run: flutter build windows
|
||||
if: ${{ steps.check_release.outcome == 'failure' }}
|
||||
# create release
|
||||
- name: Create release
|
||||
if: ${{ steps.check_release.outcome == 'failure' }}
|
||||
run: |
|
||||
Copy-Item -Path ./windows-dlls/* -Destination ./build/windows/runner/Release/
|
||||
Compress-Archive -Path ./build/windows/runner/Release/* -DestinationPath .\wsl2-distro-manager-v${{ steps.get_version.outputs.version }}.zip
|
||||
Write-Output 'gh release create v${{ steps.get_version.outputs.version }} ./build/windows/runner/Release/wsl2-distro-manager-v${{ steps.get_version.outputs.version }}.zip --generate-notes --notes "This is an automated release."'
|
||||
shell: pwsh
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
# Created using wingetcreate 0.4.3.1
|
||||
# yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.0.0.schema.json
|
||||
|
||||
PackageIdentifier: Bostrot.WSLManager
|
||||
PackageVersion: 0.5.3.0
|
||||
Installers:
|
||||
- Platform:
|
||||
- Windows.Desktop
|
||||
MinimumOSVersion: 10.0.17763.0
|
||||
Architecture: x64
|
||||
InstallerType: msix
|
||||
InstallerUrl: https://github.com/bostrot/wsl2-distro-manager/releases/download/v0.5.3%2B1/wsl2-distro-manager-v0.5.3+1.msix
|
||||
InstallerSha256: 7008769A030C541F16698DA6AD8F8D422A6F7FEECE45B9BB0A1B8D9135D09F86
|
||||
SignatureSha256: EF10E43EB9A95EC4B79548A1195DD6DFC188CE87522813A04341982C14E251D2
|
||||
PackageFamilyName: 9891PhantomDevs.WSL2Manager_rqq3vyma0b55r
|
||||
ManifestType: installer
|
||||
ManifestVersion: 1.0.0
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# Created using wingetcreate 0.4.3.1
|
||||
# yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.0.0.schema.json
|
||||
|
||||
PackageIdentifier: Bostrot.WSLManager
|
||||
PackageVersion: 0.5.3.0
|
||||
PackageLocale: en-US
|
||||
Publisher: Bostrot
|
||||
PackageName: WSL Manager
|
||||
License: GPL-3.0
|
||||
ShortDescription: A GUI to quickly manage your WSL2 instances.
|
||||
ManifestType: defaultLocale
|
||||
ManifestVersion: 1.0.0
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# Created using wingetcreate 0.4.3.1
|
||||
# yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.0.0.schema.json
|
||||
|
||||
PackageIdentifier: Bostrot.WSLManager
|
||||
PackageVersion: 0.5.3.0
|
||||
DefaultLocale: en-US
|
||||
ManifestType: version
|
||||
ManifestVersion: 1.0.0
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
# Created using wingetcreate 1.1.2.0
|
||||
# yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.2.0.schema.json
|
||||
|
||||
PackageIdentifier: Bostrot.WSLManager
|
||||
PackageVersion: 1.3.4.0
|
||||
Installers:
|
||||
- Platform:
|
||||
- Windows.Desktop
|
||||
MinimumOSVersion: 10.0.17763.0
|
||||
Architecture: x64
|
||||
InstallerType: msix
|
||||
InstallerUrl: https://github.com/bostrot/wsl2-distro-manager/releases/download/v1.3.4/wsl2-distro-manager-v1.3.4.msix
|
||||
InstallerSha256: 98B702658C0A991A4999363C2942ACB34A6BF38C305F7A7BA72A5F4D1E64B6E3
|
||||
SignatureSha256: 02EE110C2DFA2E626C27F1EAB516520717EAC4CFC96391D590FDF898C05B80ED
|
||||
PackageFamilyName: 9891PhantomDevs.WSL2Manager_rqq3vyma0b55r
|
||||
ManifestType: installer
|
||||
ManifestVersion: 1.1.0
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# Created using wingetcreate 1.1.2.0
|
||||
# yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.2.0.schema.json
|
||||
|
||||
PackageIdentifier: Bostrot.WSLManager
|
||||
PackageVersion: 1.3.4.0
|
||||
PackageLocale: en-US
|
||||
Publisher: Bostrot
|
||||
PackageName: WSL Manager
|
||||
License: GPL-3.0
|
||||
ShortDescription: A GUI to quickly manage your WSL2 instances.
|
||||
ManifestType: defaultLocale
|
||||
ManifestVersion: 1.1.0
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# Created using wingetcreate 1.1.2.0
|
||||
# yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.2.0.schema.json
|
||||
|
||||
PackageIdentifier: Bostrot.WSLManager
|
||||
PackageVersion: 1.3.4.0
|
||||
DefaultLocale: en-US
|
||||
ManifestType: version
|
||||
ManifestVersion: 1.1.0
|
||||
|
||||
97
scripts/msix_download.ps1
Normal file
97
scripts/msix_download.ps1
Normal file
@@ -0,0 +1,97 @@
|
||||
<#
|
||||
|
||||
Copyright https://github.com/MattiasC85/Scripts/blob/master/OSD/Download-AppxFromStore.ps1
|
||||
|
||||
#>
|
||||
|
||||
Param (
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string] $StoreURL,
|
||||
[Parameter(Mandatory=$False)]
|
||||
$SavePathRoot="%tmp%"
|
||||
)
|
||||
|
||||
#
|
||||
|
||||
if ($StoreURL.EndsWith("/"))
|
||||
{
|
||||
#write-host "Ends with '/'"
|
||||
$StoreURL=$StoreURL.Remove($StoreUrl.Length-1,1)
|
||||
}
|
||||
|
||||
$wchttp=[System.Net.WebClient]::new()
|
||||
$URI = "https://store.rg-adguard.net/api/GetFiles"
|
||||
$myParameters = "type=url&url=$($StoreURL)"
|
||||
#&ring=Retail&lang=sv-SE"
|
||||
|
||||
$wchttp.Headers[[System.Net.HttpRequestHeader]::ContentType]="application/x-www-form-urlencoded"
|
||||
$HtmlResult = $wchttp.UploadString($URI, $myParameters)
|
||||
|
||||
$Start=$HtmlResult.IndexOf("<p>The links were successfully received from the Microsoft Store server.</p>")
|
||||
#write-host $start
|
||||
|
||||
if ($Start -eq -1)
|
||||
{
|
||||
write-host "Could not get the links, please check the StoreURL."
|
||||
exit
|
||||
}
|
||||
|
||||
$TableEnd=($HtmlResult.LastIndexOf("</table>")+8)
|
||||
|
||||
|
||||
$SemiCleaned=$HtmlResult.Substring($start,$TableEnd-$start)
|
||||
|
||||
#https://stackoverflow.com/questions/46307976/unable-to-use-ihtmldocument2
|
||||
$newHtml=New-Object -ComObject "HTMLFile"
|
||||
try {
|
||||
# This works in PowerShell with Office installed
|
||||
$newHtml.IHTMLDocument2_write($SemiCleaned)
|
||||
}
|
||||
catch {
|
||||
# This works when Office is not installed
|
||||
$src = [System.Text.Encoding]::Unicode.GetBytes($SemiCleaned)
|
||||
$newHtml.write($src)
|
||||
}
|
||||
|
||||
$ToDownload=$newHtml.getElementsByTagName("a") | Select-Object textContent, href
|
||||
|
||||
$SavePathRoot=$([System.Environment]::ExpandEnvironmentVariables("$SavePathRoot"))
|
||||
|
||||
$LastFrontSlash=$StoreURL.LastIndexOf("/")
|
||||
$ProductID=$StoreURL.Substring($LastFrontSlash+1,$StoreURL.Length-$LastFrontSlash-1)
|
||||
|
||||
# OldRegEx Failed when the %tmp% started with a lowercase char
|
||||
#if ([regex]::IsMatch("$SavePathRoot\$ProductID","([,!@?#$%^&*()\[\]]+|\\\.\.|\\\\\.|\.\.\\\|\.\\\|\.\.\/|\.\/|\/\.\.|\/\.|;|(?<![A-Z]):)|^\w+:(\w|.*:)"))
|
||||
|
||||
if ([regex]::IsMatch("$SavePathRoot\$ProductID","([,!@?#$%^&*()\[\]]+|\\\.\.|\\\\\.|\.\.\\\|\.\\\|\.\.\/|\.\/|\/\.\.|\/\.|;|(?<![A-Za-z]):)|^\w+:(\w|.*:)"))
|
||||
{
|
||||
write-host "Invalid characters in path"$SavePathRoot\$ProductID""
|
||||
exit
|
||||
}
|
||||
|
||||
|
||||
if (!(test-path "$SavePathRoot\$ProductID"))
|
||||
{
|
||||
write-host "Creating Directorty"$SavePathRoot\$ProductID""
|
||||
|
||||
try
|
||||
{
|
||||
New-Item -ItemType Directory "$SavePathRoot\$ProductID" -ErrorAction Stop | Out-Null
|
||||
}
|
||||
catch
|
||||
{
|
||||
write-host "Failed to create directory.$([System.environment]::NewLine)$_"
|
||||
write-host "Exiting..."
|
||||
exit
|
||||
}
|
||||
}
|
||||
|
||||
Foreach ($Download in $ToDownload)
|
||||
{
|
||||
Write-host "Downloading $($Download.textContent)..."
|
||||
$wchttp.DownloadFile($Download.href, "$SavePathRoot\$ProductID\$($Download.textContent)")
|
||||
|
||||
}
|
||||
write-host "---------------------------------------"
|
||||
write-host ""
|
||||
Write-host "Download is complete..."
|
||||
71
scripts/msix_links.ps1
Normal file
71
scripts/msix_links.ps1
Normal file
@@ -0,0 +1,71 @@
|
||||
<#
|
||||
|
||||
Copyright https://github.com/MattiasC85/Scripts/blob/master/OSD/Download-AppxFromStore.ps1
|
||||
|
||||
#>
|
||||
|
||||
Param (
|
||||
[Parameter(Mandatory=$True)]
|
||||
[string] $StoreURL
|
||||
)
|
||||
|
||||
#
|
||||
|
||||
if ($StoreURL.EndsWith("/"))
|
||||
{
|
||||
#write-host "Ends with '/'"
|
||||
$StoreURL=$StoreURL.Remove($StoreUrl.Length-1,1)
|
||||
}
|
||||
|
||||
$wchttp=[System.Net.WebClient]::new()
|
||||
$URI = "https://store.rg-adguard.net/api/GetFiles"
|
||||
$myParameters = "type=url&url=$($StoreURL)"
|
||||
#&ring=Retail&lang=sv-SE"
|
||||
|
||||
$wchttp.Headers[[System.Net.HttpRequestHeader]::ContentType]="application/x-www-form-urlencoded"
|
||||
$HtmlResult = $wchttp.UploadString($URI, $myParameters)
|
||||
|
||||
$Start=$HtmlResult.IndexOf("<p>The links were successfully received from the Microsoft Store server.</p>")
|
||||
#write-host $start
|
||||
|
||||
if ($Start -eq -1)
|
||||
{
|
||||
write-host "Could not get the links, please check the StoreURL."
|
||||
exit 1
|
||||
}
|
||||
|
||||
$TableEnd=($HtmlResult.LastIndexOf("</table>")+8)
|
||||
|
||||
|
||||
$SemiCleaned=$HtmlResult.Substring($start,$TableEnd-$start)
|
||||
|
||||
#https://stackoverflow.com/questions/46307976/unable-to-use-ihtmldocument2
|
||||
$newHtml=New-Object -ComObject "HTMLFile"
|
||||
try {
|
||||
# This works in PowerShell with Office installed
|
||||
$newHtml.IHTMLDocument2_write($SemiCleaned)
|
||||
}
|
||||
catch {
|
||||
# This works when Office is not installed
|
||||
$src = [System.Text.Encoding]::Unicode.GetBytes($SemiCleaned)
|
||||
$newHtml.write($src)
|
||||
}
|
||||
|
||||
$ToDownload=$newHtml.getElementsByTagName("a") | Select-Object textContent, href
|
||||
|
||||
$SavePathRoot=$([System.Environment]::ExpandEnvironmentVariables("$SavePathRoot"))
|
||||
|
||||
$LastFrontSlash=$StoreURL.LastIndexOf("/")
|
||||
$ProductID=$StoreURL.Substring($LastFrontSlash+1,$StoreURL.Length-$LastFrontSlash-1)
|
||||
|
||||
if ([regex]::IsMatch("$SavePathRoot\$ProductID","([,!@?#$%^&*()\[\]]+|\\\.\.|\\\\\.|\.\.\\\|\.\\\|\.\.\/|\.\/|\/\.\.|\/\.|;|(?<![A-Za-z]):)|^\w+:(\w|.*:)"))
|
||||
{
|
||||
write-host "Invalid characters in path"$SavePathRoot\$ProductID""
|
||||
exit 1
|
||||
}
|
||||
|
||||
Foreach ($Download in $ToDownload)
|
||||
{
|
||||
Write-host "Name:$($Download.textContent)"
|
||||
}
|
||||
exit 0
|
||||
52
scripts/pre-push
Normal file
52
scripts/pre-push
Normal file
@@ -0,0 +1,52 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This hook will build the application before pushing
|
||||
|
||||
# Get version number
|
||||
version=$(cat pubspec.yaml | grep -o -P '(?<=version: ).*(?= # Current version)')
|
||||
|
||||
# Replace version in constants.dart with the version number
|
||||
sed -i "s/currentVersion = \".*\";/currentVersion = \"$version\";/g" lib/components/constants.dart
|
||||
|
||||
# Add constants.dart to commit
|
||||
git add lib/components/constants.dart
|
||||
|
||||
# Append to pubspec.yaml
|
||||
if ! grep -q msix_config "pubspec.yaml"; then
|
||||
cat ./certs/msix_config.yaml >> pubspec.yaml
|
||||
fi
|
||||
|
||||
# Replace msix_version in pubspec.yaml with the version number
|
||||
sed -i "s/msix_version: .*\.0/msix_version: $version\.0/g" pubspec.yaml
|
||||
|
||||
# Build msix package
|
||||
flutter pub get
|
||||
flutter pub run msix:create
|
||||
|
||||
# Create release dir
|
||||
# mkdir -p build/windows/runner/Release
|
||||
# cp windows-dlls/*.dll build/windows/runner/Release
|
||||
|
||||
# Remove the msix_config from pubspec.yaml
|
||||
sed -i '/^# start git-block-ignore/,/^# end git-block-ignore/{/^123/!d}' pubspec.yaml
|
||||
|
||||
# Add & commit the changes
|
||||
git add -f pubspec.yaml
|
||||
git add -f build/windows/runner/Release/desktop_window_plugin.dll
|
||||
git add -f build/windows/runner/Release/flutter_acrylic_plugin.dll
|
||||
git add -f build/windows/runner/Release/flutter_windows.dll
|
||||
git add -f build/windows/runner/Release/window_manager_plugin.dll
|
||||
git add -f build/windows/runner/Release/screen_retriever_plugin.dll
|
||||
git add -f build/windows/runner/Release/system_theme_plugin.dll
|
||||
git add -f build/windows/runner/Release/url_launcher_windows_plugin.dll
|
||||
git add -f build/windows/runner/Release/wsl2distromanager.exe
|
||||
git add -f build/windows/runner/Release/wsl2distromanager.msix
|
||||
git add -f build/windows/runner/Release/data
|
||||
|
||||
# git add -f build/windows/runner/Release/msvcp140.dll
|
||||
# git add -f build/windows/runner/Release/vcruntime140_1.dll
|
||||
# git add -f build/windows/runner/Release/vcruntime140.dll
|
||||
|
||||
git commit -s -m "Update version number to $version"
|
||||
|
||||
git push --no-verify
|
||||
Reference in New Issue
Block a user