diff --git a/.github/workflows/test.main.kts b/.github/workflows/test.main.kts index 43bcd960..8b306f24 100755 --- a/.github/workflows/test.main.kts +++ b/.github/workflows/test.main.kts @@ -78,6 +78,13 @@ val openSuseLeap15_2 = mapOf( "default-absent-tool" to "which" ) +val ubuntu2404 = mapOf( + "wsl-id" to "Ubuntu", + "user-id" to "Ubuntu-24.04", + "match-pattern" to "*Ubuntu*24.04*", + "default-absent-tool" to "dos2unix" +) + val ubuntu2204 = mapOf( "wsl-id" to "Ubuntu", "user-id" to "Ubuntu-22.04", @@ -111,6 +118,7 @@ val distributions = listOf( alpine, kali, openSuseLeap15_2, + ubuntu2404, ubuntu2204, ubuntu2004, ubuntu1804, diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f9fe1e76..533adb71 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -348,6 +348,10 @@ jobs: user-id: 'openSUSE-Leap-15.2' match-pattern: '*openSUSE*Leap*15.2*' default-absent-tool: 'which' + - wsl-id: 'Ubuntu' + user-id: 'Ubuntu-24.04' + match-pattern: '*Ubuntu*24.04*' + default-absent-tool: 'dos2unix' - wsl-id: 'Ubuntu' user-id: 'Ubuntu-22.04' match-pattern: '*Ubuntu*22.04*' @@ -840,6 +844,10 @@ jobs: user-id: 'openSUSE-Leap-15.2' match-pattern: '*openSUSE*Leap*15.2*' default-absent-tool: 'which' + - wsl-id: 'Ubuntu' + user-id: 'Ubuntu-24.04' + match-pattern: '*Ubuntu*24.04*' + default-absent-tool: 'dos2unix' - wsl-id: 'Ubuntu' user-id: 'Ubuntu-22.04' match-pattern: '*Ubuntu*22.04*' @@ -940,6 +948,10 @@ jobs: user-id: 'openSUSE-Leap-15.2' match-pattern: '*openSUSE*Leap*15.2*' default-absent-tool: 'which' + - wsl-id: 'Ubuntu' + user-id: 'Ubuntu-24.04' + match-pattern: '*Ubuntu*24.04*' + default-absent-tool: 'dos2unix' - wsl-id: 'Ubuntu' user-id: 'Ubuntu-22.04' match-pattern: '*Ubuntu*22.04*' @@ -1073,6 +1085,10 @@ jobs: user-id: 'openSUSE-Leap-15.2' match-pattern: '*openSUSE*Leap*15.2*' default-absent-tool: 'which' + - wsl-id: 'Ubuntu' + user-id: 'Ubuntu-24.04' + match-pattern: '*Ubuntu*24.04*' + default-absent-tool: 'dos2unix' - wsl-id: 'Ubuntu' user-id: 'Ubuntu-22.04' match-pattern: '*Ubuntu*22.04*' @@ -1302,6 +1318,10 @@ jobs: user-id: 'openSUSE-Leap-15.2' match-pattern: '*openSUSE*Leap*15.2*' default-absent-tool: 'which' + - wsl-id: 'Ubuntu' + user-id: 'Ubuntu-24.04' + match-pattern: '*Ubuntu*24.04*' + default-absent-tool: 'dos2unix' - wsl-id: 'Ubuntu' user-id: 'Ubuntu-22.04' match-pattern: '*Ubuntu*22.04*' @@ -1514,16 +1534,21 @@ jobs: match-pattern: '*openSUSE*Leap*15.2*' default-absent-tool: 'which' distribution5: + wsl-id: 'Ubuntu' + user-id: 'Ubuntu-24.04' + match-pattern: '*Ubuntu*24.04*' + default-absent-tool: 'dos2unix' + distribution6: wsl-id: 'Ubuntu' user-id: 'Ubuntu-20.04' match-pattern: '*Ubuntu*20.04*' default-absent-tool: 'dos2unix' - distribution6: + distribution7: wsl-id: 'Ubuntu-18.04' user-id: 'Ubuntu-18.04' match-pattern: '*Ubuntu*18.04*' default-absent-tool: 'dos2unix' - distribution7: + distribution8: wsl-id: 'Ubuntu-16.04' user-id: 'Ubuntu-16.04' match-pattern: '*Ubuntu*16.04*' @@ -1549,16 +1574,21 @@ jobs: match-pattern: '*openSUSE*Leap*15.2*' default-absent-tool: 'which' distribution5: + wsl-id: 'Ubuntu' + user-id: 'Ubuntu-24.04' + match-pattern: '*Ubuntu*24.04*' + default-absent-tool: 'dos2unix' + distribution6: wsl-id: 'Ubuntu' user-id: 'Ubuntu-22.04' match-pattern: '*Ubuntu*22.04*' default-absent-tool: 'dos2unix' - distribution6: + distribution7: wsl-id: 'Ubuntu-18.04' user-id: 'Ubuntu-18.04' match-pattern: '*Ubuntu*18.04*' default-absent-tool: 'dos2unix' - distribution7: + distribution8: wsl-id: 'Ubuntu-16.04' user-id: 'Ubuntu-16.04' match-pattern: '*Ubuntu*16.04*' @@ -1615,6 +1645,12 @@ jobs: distribution: '${{ matrix.distributions.distribution7.user-id }}' set-as-default: 'false' - id: 'step-8' + name: 'Execute action for ${{ matrix.distributions.distribution8.user-id }}' + uses: './' + with: + distribution: '${{ matrix.distributions.distribution8.user-id }}' + set-as-default: 'false' + - id: 'step-9' name: 'Test - wsl-bash_${{ matrix.distributions.distribution1.user-id }} should use the correct distribution' shell: 'wsl-bash_Debian {0}' run: |- @@ -1623,7 +1659,7 @@ jobs: if: |- always() && (steps.step-1.outcome == 'success') - - id: 'step-9' + - id: 'step-10' name: 'Test - wsl-bash_${{ matrix.distributions.distribution2.user-id }} should use the correct distribution' shell: 'wsl-bash_Alpine {0}' run: |- @@ -1632,7 +1668,7 @@ jobs: if: |- always() && (steps.step-2.outcome == 'success') - - id: 'step-10' + - id: 'step-11' name: 'Test - wsl-bash_${{ matrix.distributions.distribution3.user-id }} should use the correct distribution' shell: 'wsl-bash_kali-linux {0}' run: |- @@ -1641,7 +1677,7 @@ jobs: if: |- always() && (steps.step-3.outcome == 'success') - - id: 'step-11' + - id: 'step-12' name: 'Test - wsl-bash_${{ matrix.distributions.distribution4.user-id }} should use the correct distribution' shell: 'wsl-bash_openSUSE-Leap-15.2 {0}' run: |- @@ -1650,41 +1686,50 @@ jobs: if: |- always() && (steps.step-4.outcome == 'success') - - id: 'step-12' + - id: 'step-13' name: 'Test - wsl-bash_${{ matrix.distributions.distribution5.user-id }} should use the correct distribution' - shell: 'wsl-bash_Ubuntu-22.04 {0}' + shell: 'wsl-bash_Ubuntu-24.04 {0}' run: |- cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true) [[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution5.match-pattern }} ]] if: |- always() && (steps.step-5.outcome == 'success') - && (matrix.distributions.distribution5.user-id != 'Ubuntu-20.04') - - id: 'step-13' - name: 'Test - wsl-bash_${{ matrix.distributions.distribution5.user-id }} should use the correct distribution' - shell: 'wsl-bash_Ubuntu-20.04 {0}' + - id: 'step-14' + name: 'Test - wsl-bash_${{ matrix.distributions.distribution6.user-id }} should use the correct distribution' + shell: 'wsl-bash_Ubuntu-22.04 {0}' run: |- cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true) - [[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution5.match-pattern }} ]] + [[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution6.match-pattern }} ]] if: |- always() - && (steps.step-5.outcome == 'success') - && (matrix.distributions.distribution5.user-id != 'Ubuntu-22.04') - - id: 'step-14' + && (steps.step-6.outcome == 'success') + && (matrix.distributions.distribution6.user-id != 'Ubuntu-20.04') + - id: 'step-15' name: 'Test - wsl-bash_${{ matrix.distributions.distribution6.user-id }} should use the correct distribution' - shell: 'wsl-bash_Ubuntu-18.04 {0}' + shell: 'wsl-bash_Ubuntu-20.04 {0}' run: |- cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true) [[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution6.match-pattern }} ]] if: |- always() && (steps.step-6.outcome == 'success') - - id: 'step-15' + && (matrix.distributions.distribution6.user-id != 'Ubuntu-22.04') + - id: 'step-16' name: 'Test - wsl-bash_${{ matrix.distributions.distribution7.user-id }} should use the correct distribution' - shell: 'wsl-bash_Ubuntu-16.04 {0}' + shell: 'wsl-bash_Ubuntu-18.04 {0}' run: |- cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true) [[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution7.match-pattern }} ]] if: |- always() && (steps.step-7.outcome == 'success') + - id: 'step-17' + name: 'Test - wsl-bash_${{ matrix.distributions.distribution8.user-id }} should use the correct distribution' + shell: 'wsl-bash_Ubuntu-16.04 {0}' + run: |- + cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true) + [[ "$(cat <(lsb_release -a || true) <(uname -a || true) <([ -d /etc ] && find /etc -maxdepth 1 -type f \( -name '*release' -or -name 'issue*' \) -exec cat {} + || true) <([ -d /etc/products.d ] && find /etc/products.d -maxdepth 1 -type f -name '*.prod' -exec cat {} + || true) <([ -f /proc/version ] && cat /proc/version || true))" == ${{ matrix.distributions.distribution8.match-pattern }} ]] + if: |- + always() + && (steps.step-8.outcome == 'success') diff --git a/action-types.yml b/action-types.yml index 2a8a10b7..cafaa218 100644 --- a/action-types.yml +++ b/action-types.yml @@ -21,6 +21,7 @@ inputs: - Debian - kali-linux - openSUSE-Leap-15.2 + - Ubuntu-24.04 - Ubuntu-22.04 - Ubuntu-20.04 - Ubuntu-18.04 diff --git a/action.yml b/action.yml index ea82c69d..39532a50 100644 --- a/action.yml +++ b/action.yml @@ -27,7 +27,7 @@ inputs: 'Ubuntu-22.04' and 'Ubuntu-20.04' can not be used together at the same time. They use the same WSL distribution ID, so the second that is used will not be installed as the first one will be found as already installed by WSL distribution ID. - Valid values: 'Alpine', 'Debian', 'kali-linux', 'openSUSE-Leap-15.2', 'Ubuntu-22.04', 'Ubuntu-20.04', 'Ubuntu-18.04', 'Ubuntu-16.04' + Valid values: 'Alpine', 'Debian', 'kali-linux', 'openSUSE-Leap-15.2', 'Ubuntu-24.04', 'Ubuntu-22.04', 'Ubuntu-20.04', 'Ubuntu-18.04', 'Ubuntu-16.04' required: false default: Debian diff --git a/readme/README_template.md b/readme/README_template.md index a2dd9867..c34a1181 100644 --- a/readme/README_template.md +++ b/readme/README_template.md @@ -156,6 +156,7 @@ The values currently supported by this action are: * `Alpine` * `kali-linux` * `openSUSE-Leap-15.2` +* `Ubuntu-24.04` * `Ubuntu-22.04` * `Ubuntu-20.04` * `Ubuntu-18.04` diff --git a/src/main/kotlin/net/kautler/github/action/setup_wsl/Distribution.kt b/src/main/kotlin/net/kautler/github/action/setup_wsl/Distribution.kt index e41f18a4..4e76614a 100644 --- a/src/main/kotlin/net/kautler/github/action/setup_wsl/Distribution.kt +++ b/src/main/kotlin/net/kautler/github/action/setup_wsl/Distribution.kt @@ -40,7 +40,8 @@ val distributions = listOf( Ubuntu1604, Ubuntu1804, Ubuntu2004, - Ubuntu2204 + Ubuntu2204, + Ubuntu2404 ).associateBy { it.userId } sealed class Distribution( @@ -246,6 +247,17 @@ abstract class AptGetBasedDistribution : Distribution { } } +object Ubuntu2404 : AptGetBasedDistribution( + wslId = "Ubuntu", + userId = "Ubuntu-24.04", + distributionName = "Ubuntu", + version = SemVer("24.4.0", jso()), + // work-around for missing shortlink on https://learn.microsoft.com/en-us/windows/wsl/install-manual#downloading-distributions + //downloadUrl = URL("https://aka.ms/wslubuntu2404"), + productId = "9nz3klhxdjp5", + installerFile = "ubuntu.exe" +) + object Ubuntu2204 : AptGetBasedDistribution( wslId = "Ubuntu", userId = "Ubuntu-22.04",