Skip to content

Commit

Permalink
refactor(template): github action release
Browse files Browse the repository at this point in the history
- GITHUB
- GALLERY
  • Loading branch information
cage1016 committed Sep 8, 2023
1 parent 7021975 commit 48cccb9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 34 deletions.
18 changes: 8 additions & 10 deletions generator/githubactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,49 +52,47 @@ func (gg *GithubActionGenerator) Generate() error {
// generate release.yml
{
m, err := te.Execute("release.yml", map[string]interface{}{
"ReleaseName": "Release",
"ReleaseName": "Gallery Release",
"EnabledCodeSign": gg.Enabled_Code_Sign_Notarize,
"EnabledCodecov": gg.Enabled_Codecov,
"EnabledGolang": gg.Enabled_Golang,
"WorkflowName": strings.ReplaceAll(viper.GetString("workflow.name"), " ", ""),
"WorkflowName": fmt.Sprintf("%s_GALLERY", strings.ReplaceAll(viper.GetString("workflow.name"), " ", "")),
"Ldflags": fmt.Sprintf("-X %s/cmd.EnabledAutoUpdate=false", viper.GetString("go_mod_package")),
"BundleID": viper.GetString("workflow.bundle_id"),
"ApplicationIdentity": viper.GetString("gon.application_identity"),
"WorkaroundExt": "_", // fix awgo update check multiple release exist
})
if err != nil {
return err
}

err = fs.NewDefaultFs(".github/workflows").WriteFile("release.yml", m, viper.GetBool("ak_force"))
err = fs.NewDefaultFs(".github/workflows").WriteFile("release-gallery.yml", m, viper.GetBool("ak_force"))
if err != nil {
return err
}
logrus.Debugf("generating release.yml")
logrus.Debugf("generating release-gallery.yml")
}

// generate with auto update release.yml
{
m, err := te.Execute("release.yml", map[string]interface{}{
"ReleaseName": "Release_auto_update",
"ReleaseName": "Github Release",
"EnabledCodeSign": gg.Enabled_Code_Sign_Notarize,
"EnabledCodecov": gg.Enabled_Codecov,
"EnabledGolang": gg.Enabled_Golang,
"WorkflowName": fmt.Sprintf("%s_auto_update", strings.ReplaceAll(viper.GetString("workflow.name"), " ", "")),
"WorkflowName": fmt.Sprintf("%s_GITHUB", strings.ReplaceAll(viper.GetString("workflow.name"), " ", "")),
"Ldflags": fmt.Sprintf("-X %s/cmd.EnabledAutoUpdate=true", viper.GetString("go_mod_package")),
"BundleID": viper.GetString("workflow.bundle_id"),
"ApplicationIdentity": viper.GetString("gon.application_identity"),
"WorkaroundExt": "", // empty for auto update
})
if err != nil {
return err
}

err = fs.NewDefaultFs(".github/workflows").WriteFile("release_auto_update.yml", m, viper.GetBool("ak_force"))
err = fs.NewDefaultFs(".github/workflows").WriteFile("release-github.yml", m, viper.GetBool("ak_force"))
if err != nil {
return err
}
logrus.Debugf("generating release_auto_update.yml")
logrus.Debugf("generating release-github.yml")
}

return nil
Expand Down
Loading

0 comments on commit 48cccb9

Please sign in to comment.