Skip to content

Commit

Permalink
release v3.5.0 generated by @lando/prepare-release-action
Browse files Browse the repository at this point in the history
  • Loading branch information
rtfm-47 committed Nov 22, 2024
1 parent b80d322 commit 0ce0ad3
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 36 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## {{ UNRELEASED_VERSION }} - [{{ UNRELEASED_DATE }}]({{ UNRELEASED_LINK }})

## v3.5.0 - [November 22, 2024](https://github.com/lando/setup-lando/releases/tag/v3.5.0)

* Added `path` based installation to POSIX `setup-lando.sh` script
* Added GitHub Actions `RUNNER_DEBUG` support to PowerShell script
* Fixed bug preventing POSIX/Windows script from replacing existing `lando` installations
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46569,7 +46569,7 @@ var __webpack_exports__ = {};
"use strict";


const SCRIPT_VERSION = 'v3.4.5';
const SCRIPT_VERSION = 'v3.5.0';

const core = __nccwpck_require__(7484);
const exec = __nccwpck_require__(5236);
Expand Down
26 changes: 17 additions & 9 deletions dist/setup-lando.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ if ($env:LANDO_VERSION -ne $null -and $env:LANDO_VERSION -ne "" -and $Version -e
$Version = $env:LANDO_VERSION
}

$SCRIPT_VERSION = "v3.4.5"
$SCRIPT_VERSION = "v3.5.0"
$LANDO_DEFAULT_MV = "3"
$LANDO_SETUP_PS1_URL = "https://get.lando.dev/setup-lando.ps1"
$LANDO_SETUP_SH_URL = "https://get.lando.dev/setup-lando.sh"
Expand All @@ -66,6 +66,9 @@ Set-StrictMode -Version 1
# We'll still need to check exit codes on any exe we run.
$ErrorActionPreference = "Stop"

# Allow github actions to set $Debug
if ($env:RUNNER_DEBUG -ne $null -and $env:RUNNER_DEBUG -ne "") {$Debug = $true}

# Normalize debug preference
$DebugPreference = If ($Debug) { "Continue" } Else { $DebugPreference }
if ($DebugPreference -eq "Inquire" -or $DebugPreference -eq "Continue") {
Expand All @@ -74,9 +77,6 @@ if ($DebugPreference -eq "Inquire" -or $DebugPreference -eq "Continue") {
$Host.PrivateData.DebugForegroundColor = "Gray"
$Host.PrivateData.DebugBackgroundColor = $Host.UI.RawUI.BackgroundColor

# Encoding must be Unicode to support parsing wsl.exe output
[Console]::OutputEncoding = [System.Text.Encoding]::Unicode

Write-Host "Lando Windows Installer" -ForegroundColor Cyan

# Validates whether the system environment is supported
Expand All @@ -101,6 +101,7 @@ function Confirm-Environment {
# Check for WSL
$wslVersion = $null
if (Test-Path "$env:WINDIR\system32\wsl.exe") {
$env:WSL_UTF8 = "1"
$wslVersion = & wsl.exe --version | Out-String
# Check for "WSL version" string on the first line
if ($wslVersion -notmatch "WSL version") {
Expand All @@ -111,6 +112,7 @@ function Confirm-Environment {
$wslList = & wsl.exe --list --verbose | Out-String
Write-Debug "WSL Instances:`n$wslList"
}
Remove-Item Env:WSL_UTF8
}
if (-not $wslVersion) {
Write-Debug "WSL is not installed."
Expand Down Expand Up @@ -226,12 +228,12 @@ function Resolve-VersionAlias {
$variant = if ($Version -match "^3-" -and !$Fat) { "-slim" } else { "" }
$downloadUrl = "${baseUrl3}${VersionLabel}/lando-win-${arch}-${VersionLabel}${variant}.exe"
}
"^4-dev$" {
$downloadUrl = "https://files.lando.dev/core-next/lando-win-${arch}-${Version}.exe"
"^4-(dev|latest)$" {
$downloadUrl = "https://files.lando.dev/core-next/lando-win-${arch}-dev.exe"
}
"^3-dev$" {
"^3-(dev|latest)$" {
$variant = if ($Version -match "^3-" -and !$Fat) { "-slim" } else { "" }
$downloadUrl = "https://files.lando.dev/core/lando-win-${arch}-${Version}${variant}.exe"
$downloadUrl = "https://files.lando.dev/core/lando-win-${arch}-dev${variant}.exe"
}
Default {
Write-Debug "Version '$Version' is a semantic version"
Expand Down Expand Up @@ -347,7 +349,7 @@ function Install-Lando {

$filename = $downloadUrl.Split('/')[-1]

Write-Host "Downloading Lando CLI..."
Write-Host "Downloading Lando..."
$downloadDest = "$LANDO_APPDATA\$filename"
Write-Debug "From $downloadUrl to $downloadDest..."
Write-Progress -Activity "Downloading Lando $script:resolvedVersion" -Status "Preparing..." -PercentComplete 0
Expand Down Expand Up @@ -597,6 +599,12 @@ Confirm-Environment
# Select the appropriate architecture
$Arch = Select-Architecture

# Remove @lando core if applicable
if (Test-Path "$env:USERPROFILE\.lando\plugins\@lando\core" -ErrorAction SilentlyContinue) {
Write-Debug "Removing detectecd core plugin from $env:USERPROFILE\.lando\plugins\@lando..."
Remove-Item -Path "$env:USERPROFILE\.lando\plugins\@lando\core" -Recurse -Force
}

# Set up our working directory
if (-not (Test-Path "$LANDO_APPDATA" -ErrorAction SilentlyContinue)) {
Write-Debug "Creating destination directory $LANDO_APPDATA..."
Expand Down
71 changes: 47 additions & 24 deletions dist/setup-lando.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SCRIPT_VERSION="v3.4.5"
SCRIPT_VERSION="v3.5.0"
#!/bin/bash
set -u
# Lando POSIX setup script.
Expand Down Expand Up @@ -162,7 +162,7 @@ get_installer_os
# see https://github.blog/changelog/2022-05-24-github-actions-re-run-jobs-with-debug-logging/

# @TODO: no-sudo option
# @TODO: dest
# @TODO: dest based on lmv
ARCH="${LANDO_INSTALLER_ARCH:-"$INSTALLER_ARCH"}"
DEBUG="${LANDO_INSTALLER_DEBUG:-${RUNNER_DEBUG:-}}"
DEST="${LANDO_INSTALLER_DEST:-/usr/local/bin}"
Expand Down Expand Up @@ -508,11 +508,18 @@ elif [[ "${VERSION}" == "3-dev" ]] || [[ "${VERSION}" == "3-latest" ]]; then
URL="https://files.lando.dev/core/lando-${OS}-${ARCH}-dev"
VERSION_DEV=1

# CUSTOM
else
if [[ $VERSION != v* ]]; then
VERSION="v${VERSION}"
# CUSTOM VERSION
elif [[ ! -f "$VERSION" ]] && [[ $VERSION != v* ]]; then
VERSION="v${VERSION}"

# PATH VERSION
elif [[ -f "${VERSION}" ]]; then
if [[ "${VERSION}" == /* ]]; then
URL=file://$VERSION
else
URL=file://$(pwd)/$VERSION
fi
VERSION="$($VERSION version)"
fi

# Set some helper things
Expand All @@ -526,24 +533,30 @@ else
HRV="$VERSION"
fi

# set url depending on non-dev LMVs
if [[ $LMV == '3' ]] && [[ -z "${VERSION_DEV-}" ]]; then
URL="https://github.com/lando/core/releases/download/${VERSION}/lando-${OS}-${ARCH}-${VERSION}"
elif [[ $LMV == '4' ]] && [[ -z "${VERSION_DEV-}" ]]; then
URL="https://github.com/lando/core-next/releases/download/${VERSION}/lando-${OS}-${ARCH}-${VERSION}"
# if URL is still not set at this point we assume its a github version download
if [[ -z "${URL-}" ]]; then
if [[ $LMV == '3' ]] && [[ -z "${VERSION_DEV-}" ]]; then
URL="https://github.com/lando/core/releases/download/${VERSION}/lando-${OS}-${ARCH}-${VERSION}"
elif [[ $LMV == '4' ]] && [[ -z "${VERSION_DEV-}" ]]; then
URL="https://github.com/lando/core-next/releases/download/${VERSION}/lando-${OS}-${ARCH}-${VERSION}"
fi
fi

# abort if we have no URL at this point
if [[ -z "${URL-}" ]]; then
abort "could not resolve '${ORIGINAL_VERSION}' to a file or URL!"
else
debug "resolved v${LMV} version '${ORIGINAL_VERSION}' to ${VERSION} (${URL})"
fi

# autoslim all v3 urls by default
# @TODO: --fat flag to stop this?
if [[ $LMV == '3' ]] && [[ $FAT != '1' ]]; then
# @TODO: restrict this to 3 < 3.24.0 at some point?
if [[ $URL != file://* ]] && [[ $LMV == '3' ]] && [[ $FAT != '1' ]]; then
URL="${URL}-slim"
HRV="$VERSION-slim"
debug "autoslimin url for lando 3"
fi

# debug version resolution
debug "resolved v${LMV} version '${ORIGINAL_VERSION}' to ${VERSION} (${URL})"

# force setup to 0 if lando 4
if [[ $SETUP == '1' ]] && [[ $LMV == '4' ]]; then
SETUP=0
Expand Down Expand Up @@ -771,7 +784,9 @@ if [[ -z "${NONINTERACTIVE-}" ]]; then
# sudo prompt
if needs_sudo; then log "- ${tty_green}prompt${tty_reset} for ${tty_bold}sudo${tty_reset} password"; fi
# download
log "- ${tty_magenta}download${tty_reset} lando ${tty_bold}${HRV}${tty_reset} to ${tty_bold}${DEST}${tty_reset}"
if [[ $URL != file://* ]]; then log "- ${tty_magenta}download${tty_reset} lando ${tty_bold}${HRV}${tty_reset} to ${tty_bold}${DEST}${tty_reset}"
# or move
else log "- ${tty_magenta}move${tty_reset} lando ${tty_bold}${ORIGINAL_VERSION}${tty_reset} to ${tty_bold}${DEST}${tty_reset}"; fi
# setup
if [[ "$SETUP" == "1" ]]; then log "- ${tty_blue}run${tty_reset} ${tty_bold}lando setup${tty_reset}"; fi
# shellenv
Expand All @@ -786,14 +801,14 @@ if needs_sudo; then
execute_sudo true
fi

# Create directories if we need to
if [[ ! -d "$DEST" ]]; then auto_exec mkdir -p "$DEST"; fi
if [[ ! -d "$LANDO_TMPDIR" ]]; then auto_exec mkdir -p "$LANDO_TMPDIR"; fi

# LANDO
LANDO="${DEST}/lando"
LANDO_TMPFILE="${LANDO_TMPDIR}/${RANDOM}"

# Create directories if we need to
if [[ ! -d "$DEST" ]]; then auto_exec mkdir -p "$DEST"; fi
if [[ ! -d "$LANDO_TMPDIR" ]]; then auto_exec mkdir -p "$LANDO_TMPDIR"; fi

# download lando
log "${tty_magenta}downloading${tty_reset} ${tty_bold}${URL}${tty_reset} to ${tty_bold}${LANDO}${tty_reset}"
auto_exec curl \
Expand All @@ -811,13 +826,21 @@ execute "${LANDO_TMPFILE}" version >/dev/null
# NOTE: we use mv here instead of cp because of https://developer.apple.com/forums/thread/130313
auto_exec mv -f "${LANDO_TMPFILE}" "${LANDO}"

# if lando 3 then --clear
# if lando 3 then we need to do some other cleanup things
# @TODO: is there an equivalent on lando 4?
if [[ $LMV == '3' ]]; then
execute "${LANDO}" --clear >/dev/null
# ensure dirz
execute mkdir -p "$HOME/.lando/bin"
# force symlink landobin to ensure PATH primacy as best we can
execute ln -sf "${LANDO}" "$HOME/.lando/bin/lando"
# remove preexisting lando core so this one can also assert primacy
execute rm -rf "$HOME/.lando/plugins/@lando/core"
# clean
execute "${LANDO}" --clear >/dev/null;
fi

# test via log
log "${tty_green}downloaded${tty_reset} @lando/cli ${tty_bold}$("${LANDO}" version --component @lando/cli)${tty_reset} to ${tty_bold}${LANDO}${tty_reset}"
log "${tty_green}downloaded${tty_reset} lando ${tty_bold}$("${LANDO}" version --component @lando/cli)${tty_reset} to ${tty_bold}${LANDO}${tty_reset}"

# run correct setup flavor if needed
if [[ "$SETUP" == "1" ]]; then
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@lando/setup-lando",
"description": "GitHub Action to setup Lando on GitHub Actions.",
"version": "3.4.5",
"version": "3.5.0",
"author": "Mike Pirog @pirog",
"main": "setup-lando.js",
"license": "GPL-3.0",
Expand Down

0 comments on commit 0ce0ad3

Please sign in to comment.