Ver código fonte

add tag to github action

Alexander Belanger 4 anos atrás
pai
commit
8a0aafdff3
1 arquivos alterados com 9 adições e 0 exclusões
  1. 9 0
      internal/integrations/ci/actions/steps.go

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

@@ -13,6 +13,14 @@ func getCheckoutCodeStep() GithubActionYAMLStep {
 	}
 	}
 }
 }
 
 
+func getSetTagStep() GithubActionYAMLStep {
+	return GithubActionYAMLStep{
+		Name: "Set Github tag",
+		ID:   "vars",
+		Run:  `echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"`,
+	}
+}
+
 func getUpdateAppStep(serverURL, porterTokenSecretName string, projectID uint, clusterID uint, appName string, actionVersion string) GithubActionYAMLStep {
 func getUpdateAppStep(serverURL, porterTokenSecretName string, projectID uint, clusterID uint, appName string, actionVersion string) GithubActionYAMLStep {
 	return GithubActionYAMLStep{
 	return GithubActionYAMLStep{
 		Name: "Update Porter App",
 		Name: "Update Porter App",
@@ -23,6 +31,7 @@ func getUpdateAppStep(serverURL, porterTokenSecretName string, projectID uint, c
 			"host":    serverURL,
 			"host":    serverURL,
 			"project": fmt.Sprintf("%d", projectID),
 			"project": fmt.Sprintf("%d", projectID),
 			"token":   fmt.Sprintf("${{ secrets.%s }}", porterTokenSecretName),
 			"token":   fmt.Sprintf("${{ secrets.%s }}", porterTokenSecretName),
+			"tag":     "${{ steps.vars.outputs.sha_short }}",
 		},
 		},
 		Timeout: 20,
 		Timeout: 20,
 	}
 	}