From fd57c7ceae335d850acfd87c95244085c359457c Mon Sep 17 00:00:00 2001 From: Eric Date: Sun, 19 Mar 2023 00:29:27 +0100 Subject: [PATCH] Updated workflow --- .github/workflows/releaser.yml | 32 ++++++++++++++++++-------------- README.md | 6 +++++- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index 390b519..b50c056 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -19,57 +19,61 @@ jobs: $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 - $result = $(Invoke-RestMethod -Uri https://api.github.com/repos/bostrot/wsl2-distro-manager/releases/tags/v$wsl2_manager_version) + 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." - Write-Output "::set-output name=outcome::failure" + echo "::set-output name=exists::true" } else { - Write-Output "::set-output name=outcome::success" + echo "::set-output name=exists::false" } Write-Output "::set-output name=version::$wsl2_manager_version" # if get_version step does not fail just build nightly - uses: subosito/flutter-action@v2 - if: ${{ steps.get_version.outcome == 'success' }} + if: ${{ steps.get_version.outputs.exists == 'true' }} with: channel: 'stable' - run: flutter config --enable-windows-desktop - if: ${{ steps.get_version.outcome == 'success' }} + if: ${{ steps.get_version.outputs.exists == 'true' }} - run: flutter build windows - if: ${{ steps.get_version.outcome == 'success' }} + if: ${{ steps.get_version.outputs.exists == 'true' }} # create zip from dlls and Release folder - name: Create zip - if: ${{ steps.get_version.outcome == 'success' }} + if: ${{ steps.get_version.outputs.exists == 'true' }} 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 }}-${{ github.run_number }}.zip # create nightly release - uses: actions/upload-artifact@v3 name: Create nightly release - if: ${{ steps.get_version.outcome == 'success' }} + if: ${{ steps.get_version.outputs.exists == 'true' }} with: name: wsl2-distro-manager-v${{ steps.get_version.outputs.version }}-${{ github.run_number }} path: | ./wsl2-distro-manager-v${{ steps.get_version.outputs.version }}-${{ github.run_number }}.zip # if get_version step fails build - uses: subosito/flutter-action@v2 - if: ${{ steps.get_version.outcome == 'failure' }} + if: ${{ steps.get_version.outputs.exists == 'false' }} with: channel: 'stable' - name: Replace version in constants.dart - if: ${{ steps.get_version.outcome == 'failure' }} + if: ${{ steps.get_version.outputs.exists == 'false' }} run: | (Get-Content .\lib\components\constants.dart) -replace('currentVersion.*', 'currentVersion = "${{ steps.get_version.outputs.version }}";') | Set-Content .\lib\components\constants.dart - run: flutter config --enable-windows-desktop - if: ${{ steps.get_version.outcome == 'failure' }} + if: ${{ steps.get_version.outputs.exists == 'false' }} - run: flutter build windows - if: ${{ steps.get_version.outcome == 'failure' }} + if: ${{ steps.get_version.outputs.exists == 'false' }} # create release - name: Create release - if: ${{ steps.get_version.outcome == 'failure' }} + if: ${{ steps.get_version.outputs.exists == 'false' }} 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."' + gh release create v${{ steps.get_version.outputs.version }} .\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 }} diff --git a/README.md b/README.md index 48f6e1e..94ea70f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -![Jenkins](https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fjenkins.aachen.dev%2Fjob%2Fwsl2-distro-manager&style=for-the-badge) +![GitHub Workflow](https://img.shields.io/github/actions/workflow/status/bostrot/wsl2-distro-manager/releaser.yml?branch=main&label=nightly&style=for-the-badge) ![GitHub Release Date](https://img.shields.io/github/release-date/bostrot/wsl2-distro-manager?style=for-the-badge) ![GitHub release (latest by date)](https://img.shields.io/github/v/release/bostrot/wsl2-distro-manager?style=for-the-badge) ![GitHub closed issues](https://img.shields.io/github/issues-closed-raw/bostrot/wsl2-distro-manager?style=for-the-badge) @@ -34,6 +34,10 @@ as a direct download from the [Releases](https://github.com/bostrot/wsl2-distro- `choco install wsl2-distro-manager` (maintained by [@mikeee](https://github.com/mikeee/ChocoPackages)) +## Nightly + +The last build can be found as artificats in the "releaser" workflow or via [this link](https://nightly.link/bostrot/wsl2-distro-manager/workflows/releaser/main/wsl2-distro-manager-v1.6.0-14.zip). + ## Build Enable Flutter Desktop `flutter config --enable-windows-desktop` (https://flutter.dev/desktop)