|
9 | 9 | using: composite |
10 | 10 | steps: |
11 | 11 | # Download the powershell '.tar.gz' archive |
12 | | - - run: curl -L -o /tmp/powershell.tar.gz https://github.com/PowerShell/PowerShell/releases/download/v"$POWERSHELL_VERSION"/powershell-"$POWERSHELL_VERSION"-linux-x64.tar.gz |
| 12 | + - run: curl -L -o /tmp/powershell.tar.gz "https://github.com/PowerShell/PowerShell/releases/download/v$POWERSHELL_VERSION/powershell-$POWERSHELL_VERSION-linux-x64.tar.gz" |
13 | 13 | shell: bash |
14 | | - env: &powershell_env |
| 14 | + env: |
15 | 15 | POWERSHELL_VERSION: ${{ inputs.version }} |
16 | 16 |
|
17 | 17 | # Create the target folder where powershell will be placed |
18 | | - - run: sudo mkdir -p /opt/microsoft/powershell/"$POWERSHELL_VERSION" |
| 18 | + - run: sudo mkdir -p "/opt/microsoft/powershell/$POWERSHELL_VERSION" |
19 | 19 | shell: bash |
20 | | - env: *powershell_env |
| 20 | + env: |
| 21 | + POWERSHELL_VERSION: ${{ inputs.version }} |
21 | 22 |
|
22 | 23 | # Expand powershell to the target folder |
23 | | - - run: sudo tar zxf /tmp/powershell.tar.gz -C /opt/microsoft/powershell/"$POWERSHELL_VERSION" |
| 24 | + - run: sudo tar zxf /tmp/powershell.tar.gz -C "/opt/microsoft/powershell/$POWERSHELL_VERSION" |
24 | 25 | shell: bash |
25 | | - env: *powershell_env |
| 26 | + env: |
| 27 | + POWERSHELL_VERSION: ${{ inputs.version }} |
26 | 28 |
|
27 | 29 | # Set execute permissions |
28 | | - - run: sudo chmod +x /opt/microsoft/powershell/"$POWERSHELL_VERSION"/pwsh |
| 30 | + - run: sudo chmod +x "/opt/microsoft/powershell/$POWERSHELL_VERSION/pwsh" |
29 | 31 | shell: bash |
30 | | - env: *powershell_env |
| 32 | + env: |
| 33 | + POWERSHELL_VERSION: ${{ inputs.version }} |
31 | 34 |
|
32 | 35 | # Unlink the original pwsh binary already present in the system |
33 | 36 | - run: sudo unlink /usr/bin/pwsh |
34 | 37 | shell: bash |
35 | 38 |
|
36 | 39 | # Create the symbolic link that points to pwsh |
37 | | - - run: sudo ln -s /opt/microsoft/powershell/"$POWERSHELL_VERSION"/pwsh /usr/bin/pwsh |
| 40 | + - run: sudo ln -s "/opt/microsoft/powershell/$POWERSHELL_VERSION/pwsh" /usr/bin/pwsh |
38 | 41 | shell: bash |
39 | | - env: *powershell_env |
| 42 | + env: |
| 43 | + POWERSHELL_VERSION: ${{ inputs.version }} |
40 | 44 |
|
41 | 45 | # Verify the installation by checking the `pwsh` command version. |
42 | 46 | - run: | |
43 | 47 | pwsh --version |
44 | 48 | [[ "$(pwsh --version)" == "PowerShell $POWERSHELL_VERSION" ]] |
45 | 49 | shell: bash |
46 | | - env: *powershell_env |
| 50 | + env: |
| 51 | + POWERSHELL_VERSION: ${{ inputs.version }} |
47 | 52 |
|
48 | 53 | # Verify the installation by using the `pwsh` shell. |
49 | 54 | - run: | |
50 | 55 | $PSVersionTable |
51 | 56 | if ( $PSVersionTable.PSVersion.ToString() -ne "$env:POWERSHELL_VERSION" ) { exit 1 } |
52 | 57 | shell: pwsh |
53 | | - env: *powershell_env |
| 58 | + env: |
| 59 | + POWERSHELL_VERSION: ${{ inputs.version }} |
0 commit comments