Skip to content

Commit

Permalink
Running the install process in bash
Browse files Browse the repository at this point in the history
  • Loading branch information
BenedekFarkas committed Oct 20, 2024
1 parent e9ea3d7 commit f28a8a8
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions .github/actions/install-sqlcmd/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,28 @@ description: Installs the SQL Server command-line tools (https://learn.microsoft
runs:
using: composite
steps:
- name: Setup Scripts
shell: pwsh
run: |
(Resolve-Path '${{ github.action_path }}/../../../Scripts').Path >> $Env:GITHUB_PATH
- name: Check if sqlcmd is installed
id: check-sqlcmd
shell: pwsh
run: |
Set-GitHubOutput 'available' ($null -ne (Get-Command sqlcmd -ErrorAction SilentlyContinue))
# Source: https://learn.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools?tabs=ubuntu-install#install-tools-on-linux
- name: Install sqlcmd on Linux
shell: pwsh
if: runner.os == 'Linux' && steps.check-sqlcmd.outputs.available != 'true'
shell: bash
run: |
if ($Env:RUNNER_OS -eq 'Linux' -and $null -eq (Get-Command sqlcmd -ErrorAction SilentlyContinue))
{
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo apt-get install mssql-tools18 unixodbc-dev -y --force-yes
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc
}
curl https://packages.microsoft.com/keys/microsoft.asc | sudo tee /etc/apt/trusted.gpg.d/microsoft.asc
curl https://packages.microsoft.com/config/ubuntu/22.04/prod.list | sudo tee /etc/apt/sources.list.d/mssql-release.list
sudo apt-get update
sudo apt-get install mssql-tools18 unixodbc-dev -y --force-yes
echo 'export PATH="$PATH:/opt/mssql-tools18/bin"' >> ~/.bashrc
source ~/.bashrc
- name: Display sqlcmd version
shell: pwsh
Expand Down

0 comments on commit f28a8a8

Please sign in to comment.