Version bump to 1.8.13 #179
This file contains 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: Releaser | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- '*' | |
paths: | |
- 'lib/**/*' | |
- 'assets/**/*' | |
- 'windows/**/*' | |
- 'pubspec.yaml' | |
jobs: | |
build: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# get version from pubspec.yaml and check if release already exists | |
- name: Get version | |
id: get_version | |
run: | | |
$pattern = "version: (.*?) \#" | |
$string = Get-Content pubspec.yaml | |
$wsl2_manager_version = [regex]::match($string, $pattern).Groups[1].Value | |
# Make web REST call to check if release already exists | |
Try { | |
$result = $(Invoke-RestMethod -Uri https://api.github.com/repos/bostrot/wsl2-distro-manager/releases/tags/v$wsl2_manager_version) | |
} Catch { | |
$result = $false | |
} | |
if ($result) { | |
Write-Output "Release v$wsl2_manager_version already exists." | |
echo "::set-output name=exists::true" | |
} else { | |
echo "::set-output name=exists::false" | |
} | |
Write-Output "::set-output name=version::$wsl2_manager_version" | |
# Setup & build | |
- name: Replace version in constants.dart | |
run: | | |
(Get-Content .\lib\components\constants.dart) -replace('currentVersion.*', 'currentVersion = "${{ steps.get_version.outputs.version }}";') | Set-Content .\lib\components\constants.dart | |
- name: Replace version in pubspec.yaml for msix | |
run: | | |
(Get-Content .\pubspec.yaml) -replace('msix_version: (.*)', 'msix_version: ${{ steps.get_version.outputs.version }}.0') | Set-Content .\pubspec.yaml | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
- run: flutter config --enable-windows-desktop | |
- run: flutter build windows | |
- run: dart run msix:create | |
# Create nightly release | |
- name: Create zip | |
if: ${{ steps.get_version.outputs.exists == 'true' }} | |
run: | | |
Move-Item .\build\windows\x64\runner\Release\wsl2distromanager.msix .\wsl2-distro-manager-v${{ steps.get_version.outputs.version }}-nightly.msix | |
Copy-Item -Path ./windows-dlls/* -Destination ./build/windows/x64/runner/Release/ | |
Compress-Archive -Path ./build/windows/x64/runner/Release/* -DestinationPath .\wsl2-distro-manager-v${{ steps.get_version.outputs.version }}-nightly.zip | |
- uses: actions/upload-artifact@v3 | |
name: Create nightly release (ZIP) | |
if: ${{ steps.get_version.outputs.exists == 'true' }} | |
with: | |
name: wsl2-distro-manager-nightly-archive | |
path: | | |
./wsl2-distro-manager-v${{ steps.get_version.outputs.version }}-nightly.zip | |
- uses: actions/upload-artifact@v3 | |
name: Create nightly release (MSIX) | |
if: ${{ steps.get_version.outputs.exists == 'true' }} | |
with: | |
name: wsl2-distro-manager-nightly-msix | |
path: | | |
./wsl2-distro-manager-v${{ steps.get_version.outputs.version }}-nightly.msix | |
# Create full release with tag (only if branch is main) | |
- name: Create release | |
if: ${{ steps.get_version.outputs.exists == 'false' && github.ref == 'refs/heads/main' }} | |
run: | | |
Move-Item .\build\windows\x64\runner\Release\wsl2distromanager.msix .\wsl2-distro-manager-v${{ steps.get_version.outputs.version }}-unsigned.msix | |
Copy-Item -Path ./windows-dlls/* -Destination ./build/windows/x64/runner/Release/ | |
Compress-Archive -Path ./build/windows/x64/runner/Release/* -DestinationPath .\wsl2-distro-manager-v${{ steps.get_version.outputs.version }}.zip | |
gh release create v${{ steps.get_version.outputs.version }} .\wsl2-distro-manager-v${{ steps.get_version.outputs.version }}.zip .\wsl2-distro-manager-v${{ steps.get_version.outputs.version }}-unsigned.msix --generate-notes --notes "This is an automated release." | |
shell: pwsh | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |