|
|
@@ -11,36 +11,18 @@ func getCheckoutCodeStep() GithubActionYAMLStep {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const download string = `name=$(curl -s https://api.github.com/repos/porter-dev/porter/releases/latest | grep "browser_download_url.*/porter_.*_Linux_x86_64\.zip" | cut -d ":" -f 2,3 | tr -d \")
|
|
|
-name=$(basename $name)
|
|
|
-curl -L https://github.com/porter-dev/porter/releases/latest/download/$name --output $name
|
|
|
-unzip -a $name
|
|
|
-rm $name
|
|
|
-chmod +x ./porter
|
|
|
-sudo mv ./porter /usr/local/bin/porter
|
|
|
-`
|
|
|
-
|
|
|
-func getDownloadPorterStep() GithubActionYAMLStep {
|
|
|
- return GithubActionYAMLStep{
|
|
|
- Name: "Download Porter",
|
|
|
- ID: "download_porter",
|
|
|
- Run: download,
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-const configure string = `porter update --app %s`
|
|
|
-
|
|
|
-func getConfigurePorterStep(serverURL, porterTokenSecretName string, projectID uint, clusterID uint, appName string) GithubActionYAMLStep {
|
|
|
+func getUpdateAppStep(serverURL, porterTokenSecretName string, projectID uint, clusterID uint, appName string) GithubActionYAMLStep {
|
|
|
return GithubActionYAMLStep{
|
|
|
- Name: "Update Porter App",
|
|
|
- ID: "update_porter",
|
|
|
- Run: fmt.Sprintf(configure, appName),
|
|
|
- Timeout: 20,
|
|
|
- Env: map[string]string{
|
|
|
- "PORTER_TOKEN": fmt.Sprintf("${{ secrets.%s }}", porterTokenSecretName),
|
|
|
- "PORTER_HOST": serverURL,
|
|
|
- "PORTER_PROJECT": fmt.Sprintf("%d", projectID),
|
|
|
- "PORTER_CLUSTER": fmt.Sprintf("%d", clusterID),
|
|
|
+ Name: "Update Porter App",
|
|
|
+ // TODO: tag a version (v2.0.0?) and pin here
|
|
|
+ Uses: "porter-dev/porter-update-action@main",
|
|
|
+ With: map[string]string{
|
|
|
+ "app": appName,
|
|
|
+ "cluster": fmt.Sprintf("%d", clusterID),
|
|
|
+ "host": serverURL,
|
|
|
+ "project": fmt.Sprintf("%d", projectID),
|
|
|
+ "token": fmt.Sprintf("${{ secrets.%s }}", porterTokenSecretName),
|
|
|
},
|
|
|
+ Timeout: 20,
|
|
|
}
|
|
|
}
|