diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11db40e..6227083 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,7 @@ jobs: version: - 2017 - 2019 + - 2022 exclude: - force-encryption: "true" os: ubuntu-24.04 diff --git a/action.yml b/action.yml index f8577b7..24f3177 100644 --- a/action.yml +++ b/action.yml @@ -13,10 +13,12 @@ inputs: default: "false" sa-password: description: "The SA password for the SQL instance" - required: true + required: false + default: "bHuZH81%cGC6" version: description: "The version of the SQL instance" - required: true + required: false + default: "2022" runs: using: "composite" steps: diff --git a/install.ps1 b/install.ps1 index abedea7..0733698 100644 --- a/install.ps1 +++ b/install.ps1 @@ -3,7 +3,7 @@ param ( [string[]]$Components, [bool]$ForceEncryption, [string]$SaPassword, - [ValidateSet("2017", "2019")] + [ValidateSet("2017", "2019", "2022")] [string]$Version ) @@ -101,8 +101,15 @@ forceencryption = 1 $AdditionalContainerConfiguration = "-v /opt/mssql/mssql.conf:/var/opt/mssql/mssql.conf -v /opt/mssql/mssql.pem:/var/opt/mssql/mssql.pem -v /opt/mssql/mssql.key:/var/opt/mssql/mssql.key" } + if ($Version -Eq "2022") { + $ToolsPath = "/opt/mssql-tools18" + } + else { + $ToolsPath = "/opt/mssql-tools" + } + Write-Output "Starting a Docker Container" - Invoke-Expression "docker run --name=`"sql`" -e `"ACCEPT_EULA=Y`"-e `"SA_PASSWORD=$SaPassword`" -e `"MSSQL_PID=Express`" --health-cmd=`"/opt/mssql-tools/bin/sqlcmd -C -S localhost -U sa -P '$SaPassword' -Q 'SELECT 1' -b -o /dev/null`" --health-start-period=`"10s`" --health-retries=3 --health-interval=`"10s`" -p 1433:1433 $AdditionalContainerConfiguration -d `"mcr.microsoft.com/mssql/server:$Version-latest`"" + Invoke-Expression "docker run --name=`"sql`" -e `"ACCEPT_EULA=Y`"-e `"SA_PASSWORD=$SaPassword`" -e `"MSSQL_PID=Express`" --health-cmd=`"$ToolsPath/bin/sqlcmd -C -S localhost -U sa -P '$SaPassword' -Q 'SELECT 1' -b -o /dev/null`" --health-start-period=`"10s`" --health-retries=3 --health-interval=`"10s`" -p 1433:1433 $AdditionalContainerConfiguration -d `"mcr.microsoft.com/mssql/server:$Version-latest`"" Wait-ForContainer } @@ -119,6 +126,10 @@ forceencryption = 1 $DownloadUrl = "https://download.microsoft.com/download/7/c/1/7c14e92e-bdcb-4f89-b7cf-93543e7112d1/SQLEXPR_x64_ENU.exe" $MajorVersion = 15 } + "2022" { + $DownloadUrl = "https://download.microsoft.com/download/3/8/d/38de7036-2433-4207-8eae-06e247e17b25/SQLEXPR_x64_ENU.exe" + $MajorVersion = 16 + } } Invoke-WebRequest $DownloadUrl -OutFile "C:\Downloads\mssql.exe"