Просмотр исходного кода

refactor: use the setup-porter action and run porter directly on github runner (#3891)

jose-fully-ported 2 лет назад
Родитель
Сommit
800e736397

+ 6 - 6
dashboard/src/main/home/app-dashboard/new-app-flow/utils.ts

@@ -39,11 +39,11 @@ jobs:
     - name: Set Github tag
       id: vars
       run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
+    - name: Setup porter
+      uses: porter-dev/setup-porter@v0.1.0
     - name: Deploy stack
       timeout-minutes: 30
-      uses: porter-dev/porter-cli-action@v0.1.0
-      with:
-        command: apply -f ${porterYamlPath}
+      run: porter apply -f ${porterYamlPath}
       env:
         PORTER_CLUSTER: ${clusterId}
         PORTER_HOST: https://dashboard.getporter.dev
@@ -81,11 +81,11 @@ jobs:
     - name: Set Github tag
       id: vars
       run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
+    - name: Setup porter
+      uses: porter-dev/setup-porter@v0.1.0
     - name: Build and deploy preview environment
       timeout-minutes: 30
-      uses: porter-dev/porter-cli-action@v0.1.0
-      with:
-        command: apply -f ${porterYamlPath} --preview
+      run: porter apply -f ${porterYamlPath} --preview
       env:
         PORTER_CLUSTER: ${clusterId}
         PORTER_HOST: https://dashboard.getporter.dev

+ 1 - 0
internal/integrations/ci/actions/stack.go

@@ -177,6 +177,7 @@ func getStackApplyActionYAML(opts *GetStackApplyActionYAMLOpts) ([]byte, error)
 	gaSteps := []GithubActionYAMLStep{
 		getCheckoutCodeStep(),
 		getSetTagStep(),
+		getSetupPorterStep(),
 		getDeployStackStep(
 			opts.ServerURL,
 			opts.SecretName,

+ 9 - 5
internal/integrations/ci/actions/steps.go

@@ -26,6 +26,13 @@ func getSetTagStep() GithubActionYAMLStep {
 	}
 }
 
+func getSetupPorterStep() GithubActionYAMLStep {
+	return GithubActionYAMLStep{
+		Name: "Setup porter",
+		Uses: "porter-dev/setup-porter@v0.1.0",
+	}
+}
+
 func getUpdateAppStep(serverURL, porterTokenSecretName string, projectID uint, clusterID uint, appName string, appNamespace, actionVersion string) GithubActionYAMLStep {
 	return GithubActionYAMLStep{
 		Name: "Update Porter App",
@@ -83,7 +90,7 @@ func getDeployStackStep(
 		path = "porter.yaml"
 	}
 
-	command := fmt.Sprintf("apply -f %s", path)
+	command := fmt.Sprintf("porter apply -f %s", path)
 	if preview {
 		command = fmt.Sprintf("%s --preview", command)
 	}
@@ -95,10 +102,7 @@ func getDeployStackStep(
 
 	return GithubActionYAMLStep{
 		Name: name,
-		Uses: fmt.Sprintf("%s@%s", cliActionName, actionVersion),
-		With: map[string]string{
-			"command": command,
-		},
+		Run:  command,
 		Env: map[string]string{
 			"PORTER_CLUSTER":    fmt.Sprintf("%d", clusterID),
 			"PORTER_HOST":       serverURL,