diff --git a/Dockerfile b/Dockerfile index ab1abeef..6f8c4d5d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,12 +46,14 @@ RUN dotnet --list-sdks RUN apk --update --no-cache add wget \ curl \ git \ - php \ + php82 \ php-ctype php-dom php-json php-mbstring php-phar php-tokenizer php-xml php-xmlwriter \ php-curl \ php-openssl \ php-iconv \ --repository http://nl.alpinelinux.org/alpine/edge/testing/ + +RUN ln -s /usr/bin/php82 /usr/bin/php RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer RUN mkdir -p /var/www WORKDIR /var/www diff --git a/internal/actions/runWorkflow.go b/internal/actions/runWorkflow.go index ab40b992..f57f29eb 100644 --- a/internal/actions/runWorkflow.go +++ b/internal/actions/runWorkflow.go @@ -2,8 +2,6 @@ package actions import ( "fmt" - - "github.com/hashicorp/go-version" "github.com/speakeasy-api/sdk-generation-action/internal/configuration" "github.com/speakeasy-api/sdk-generation-action/internal/git" "github.com/speakeasy-api/sdk-generation-action/internal/run" @@ -20,14 +18,19 @@ func RunWorkflow() error { return err } - resolvedVersion, err := cli.Download(environment.GetPinnedSpeakeasyVersion(), g) + // The top-level CLI can always use latest. The CLI itself manages pinned versions. + resolvedVersion, err := cli.Download("latest", g) if err != nil { return err } - minimumVersionForRun := version.Must(version.NewVersion("1.161.0")) - if !cli.IsAtLeastVersion(minimumVersionForRun) { - return fmt.Errorf("action requires at least version %s of the speakeasy CLI", minimumVersionForRun) + pinnedVersion := cli.GetVersion(environment.GetPinnedSpeakeasyVersion()) + if pinnedVersion != "latest" { + resolvedVersion = pinnedVersion + // This environment variable is read by the CLI to determine which version should be used to execute `run` + if err := environment.SetCLIVersionToUse(pinnedVersion); err != nil { + return fmt.Errorf("failed to set pinned speakeasy version: %w", err) + } } mode := environment.GetMode() diff --git a/internal/environment/environment.go b/internal/environment/environment.go index c1240cda..4a70d384 100644 --- a/internal/environment/environment.go +++ b/internal/environment/environment.go @@ -218,3 +218,7 @@ func GetWorkspace() string { func ShouldOutputTests() bool { return os.Getenv("INPUT_OUTPUT_TESTS") == "true" } + +func SetCLIVersionToUse(version string) error { + return os.Setenv("PINNED_VERSION", version) +}