Skip to content

Commit

Permalink
[ci] Support subfolder plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
IceflowRE committed Sep 1, 2024
1 parent 6261c7e commit bcff5c2
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,51 +15,67 @@ jobs:
config:
- {
id: "aspect_ratio_resize_container",
id-name: "aspect_ratio_resize_container",
name: "AspectRatioResizeContainer",
asset-id: "2089",
}
- {
id: "custom_theme_overrides",
id-name: "custom_theme_overrides",
name: "Custom Theme Overrides",
asset-id: "2091",
}
- {
id: "git_sha_project_setting",
id-name: "git_sha_project_setting",
name: "Git SHA Project Setting",
asset-id: "1979",
}
- {
id: "glogging",
id-name: "glogging",
name: "GLogging",
asset-id: "no-deploy",
}
- {
id: "hide_private_properties",
id-name: "hide_private_properties",
name: "Hide Private Properties",
asset-id: "1989",
}
- {
id: "icon_explorer",
id-name: "icon_explorer",
name: "Icon Explorer",
asset-id: "2511",
}
- {
id: "icons_patcher",
id-name: "icons_patcher",
name: "Icons Patcher",
asset-id: "1980",
}
- {
id: "licenses",
id-name: "licenses",
name: "License Manager",
asset-id: "1969",
}
- {
id: "kenyoni/plugin_reloader",
id-name: "plugin_reloader",
name: "Plugin Reloader",
asset-id: "no-deploy",
}
- {
id: "qr_code",
id-name: "qr_code",
name: "QR Code",
asset-id: "2090",
}
- {
id: "texture_button_colored",
id-name: "texture_button_colored",
name: "TextureButtonColored",
asset-id: "2092",
}
Expand Down Expand Up @@ -92,20 +108,20 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.config.name }}
path: archives/${{ matrix.config.id }}-*.zip
path: archives/${{ matrix.config.id-name }}-*.zip

- uses: mukunku/tag-exists-action@v1.2.0
id: checkTag
with:
tag: ${{ matrix.config.id }}-${{ steps.prepare-artifacts.outputs.version }}
tag: ${{ matrix.config.id-name }}-${{ steps.prepare-artifacts.outputs.version }}

- name: Prepare Release
if: ${{ steps.checkTag.outputs.exists == 'false' }}
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git tag ${{ matrix.config.id }}-${{ steps.prepare-artifacts.outputs.version }}
git push origin tag ${{ matrix.config.id }}-${{ steps.prepare-artifacts.outputs.version }}
git tag ${{ matrix.config.id-name }}-${{ steps.prepare-artifacts.outputs.version }}
git push origin tag ${{ matrix.config.id-name }}-${{ steps.prepare-artifacts.outputs.version }}
# wait 5s that the pushed tag is available in the next step, sometimes the next step saw only the local tag
- name: Wait 5s
Expand All @@ -117,7 +133,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
gh release create ${{ matrix.config.id }}-${{ steps.prepare-artifacts.outputs.version }} ./archives/* --title "${{ matrix.config.name }} ${{ steps.prepare-artifacts.outputs.version }}" --notes "${{ steps.prepare-artifacts.outputs.notes }}"
gh release create ${{ matrix.config.id-name }}-${{ steps.prepare-artifacts.outputs.version }} ./archives/* --title "${{ matrix.config.name }} ${{ steps.prepare-artifacts.outputs.version }}" --notes "${{ steps.prepare-artifacts.outputs.notes }}"
#- name: Deploy to Godot Asset Library
# if: ${{ matrix.config.asset-id != 'no-deploy' }}
Expand Down
4 changes: 2 additions & 2 deletions publisher/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func doActionAssetLibrary(baseDir string, addonId string, cfg assetLibraryAction
assetData := internal.AssetData{
AssetId: cfg.AssetId,
Title: plgCfg.Plugin.Name,
Description: fmt.Sprintf("%s\n\n%s", plgCfg.Plugin.Description, fmt.Sprintf("More detailed information and documentation is available at https://kenyoni-software.github.io/godot-addons/addons/%s", addon.Id())),
Description: fmt.Sprintf("%s\n\n%s", plgCfg.Plugin.Description, fmt.Sprintf("More detailed information and documentation is available at https://kenyoni-software.github.io/godot-addons/addons/%s", addon.IdName())),
VersionString: plgCfg.Plugin.Version,
GodotVersion: gdMinversion,
CategoryId: cfg.Category,
Expand Down Expand Up @@ -222,7 +222,7 @@ func doActionZip(baseDir string, addonId string, cfg zipActionCfg) {
if outputDir == "" {
outputDir = filepath.Join(addon.ProjectPath(), "archives")
}
outputFile := filepath.Join(outputDir, addon.Id()+"-"+strings.ReplaceAll(plgCfg.Plugin.Version, ".", "_")+".zip")
outputFile := filepath.Join(outputDir, addon.IdName()+"-"+strings.ReplaceAll(plgCfg.Plugin.Version, ".", "_")+".zip")
err = addon.Zip(outputFile)
if err != nil {
log.Fatalln(err)
Expand Down
10 changes: 9 additions & 1 deletion publisher/internal/addon.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log"
"os"
"path/filepath"
"strings"

"github.com/pelletier/go-toml/v2"
)
Expand Down Expand Up @@ -39,10 +40,17 @@ func NewAddon(id string, projectPath string) *Addon {
}
}

// Id contains the namespace directory and the addon directory name like "kenyoni/addon_name"
func (addon *Addon) Id() string {
return addon.addonId
}

// IdName is only the addon directory name like "addon_name"
func (addon *Addon) IdName() string {
splitted := strings.Split(addon.addonId, "/")
return splitted[len(splitted)-1]
}

func (addon *Addon) ProjectPath() string {
return addon.projectPath
}
Expand Down Expand Up @@ -74,7 +82,7 @@ func (addon *Addon) Zip(outputFile string) error {
if err != nil {
return err
}
exampleDir := filepath.Join(addon.ProjectPath(), "examples", addon.Id())
exampleDir := filepath.Join(addon.ProjectPath(), "examples", addon.IdName())
// zip example directory only if it exists
if _, err := os.Stat(exampleDir); err == nil {
err = ZipDir(zw, exampleDir, filepath.Join("examples", addon.Id()))
Expand Down

0 comments on commit bcff5c2

Please sign in to comment.