Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ endif
bundle:
rm -rf dist/
mkdir -p dist/$(PLUGIN_ID)
cp $(MANIFEST_FILE) dist/$(PLUGIN_ID)/
./build/bin/manifest dist
ifneq ($(wildcard $(ASSETS_DIR)/.),)
cp -r $(ASSETS_DIR) dist/$(PLUGIN_ID)/
endif
Expand Down
31 changes: 31 additions & 0 deletions build/manifest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"encoding/json"
"fmt"
"net/url"
"os"
"strings"

Expand Down Expand Up @@ -84,6 +85,11 @@ func main() {
panic("failed to apply manifest: " + err.Error())
}

case "dist":
if err := distManifest(manifest); err != nil {
panic("failed to write manifest to dist directory: " + err.Error())
}

default:
panic("unrecognized command: " + cmd)
}
Expand Down Expand Up @@ -133,6 +139,13 @@ func findManifest() (*model.Manifest, error) {
manifest.Version = strings.TrimPrefix(version, "v")
}

if manifest.ReleaseNotesURL == "" && BuildTagLatest != "" && manifest.HomepageURL != "" {
manifest.ReleaseNotesURL, err = url.JoinPath(manifest.HomepageURL, "releases", "tag", BuildTagLatest)
if err != nil {
return nil, errors.Wrap(err, "failed to generate release notes URL")
}
}
Comment thread
nang2049 marked this conversation as resolved.

return &manifest, nil
}

Expand Down Expand Up @@ -179,3 +192,21 @@ func applyManifest(manifest *model.Manifest) error {

return nil
}

func distManifest(manifest *model.Manifest) error {
manifestBytes, err := json.MarshalIndent(manifest, "", " ")
if err != nil {
return err
}

distDir := fmt.Sprintf("dist/%s", manifest.Id)
if err := os.MkdirAll(distDir, 0750); err != nil {
return errors.Wrap(err, "failed to create dist directory")
}

if err := os.WriteFile(fmt.Sprintf("%s/plugin.json", distDir), manifestBytes, 0600); err != nil {
return errors.Wrap(err, "failed to write plugin.json")
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}

return nil
}
2 changes: 2 additions & 0 deletions plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"id": "com.mattermost.wrangler",
"name": "Wrangler",
"description": "Manage messages across teams and channels",
"homepage_url": "https://github.com/mattermost/mattermost-plugin-wrangler",
"support_url": "https://github.com/mattermost/mattermost-plugin-wrangler/issues",
"min_server_version": "10.11.0",
"server": {
"executables": {
Expand Down
Loading