Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gravufo committed Apr 21, 2023
1 parent 6b1410a commit fb5ddc5
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 113 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/cd.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: ci

on:
push:
# Publish `master` as Docker `latest` image.
branches:
- master

# Publish `v1.2.3` tags as releases.
tags:
- v*

# Run tests for any PRs.
pull_request:

jobs:
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.20'
cache: false
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
build:
name: build
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.20'
cache: false
- uses: actions/checkout@v3
- name: build
run: make dist
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.20'
cache: false
- uses: actions/checkout@v3
- name: build
run: make test
18 changes: 0 additions & 18 deletions .github/workflows/ci.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ linters-settings:
gofmt:
simplify: true
goimports:
local-prefixes: github.com/mattermost/mattermost-starter-template
local-prefixes: github.com/opendwellers/mattermost-partyparrots-sync
govet:
check-shadowing: true
enable-all: true
Expand Down
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

5 changes: 0 additions & 5 deletions .vscode/settings.json

This file was deleted.

86 changes: 17 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,31 @@
# Plugin Starter Template [![CircleCI branch](https://img.shields.io/circleci/project/github/mattermost/mattermost-plugin-starter-template/master.svg)](https://circleci.com/gh/mattermost/mattermost-plugin-starter-template)
# Mattermost Party Parrots Sync Plugin

This plugin serves as a starting point for writing a Mattermost plugin. Feel free to base your own plugin off this repository.

To learn more about plugins, see [our plugin documentation](https://developers.mattermost.com/extend/plugins/).

This template requires node v16 and npm v8. You can download and install nvm to manage your node versions by following the instructions [here](https://github.com/nvm-sh/nvm). Once you've setup the project simply run `nvm i` within the root folder to use the suggested version of node.
This plugin allows you to sync all Party Parrots from [Cult of the Party Parrot](https://cultofthepartyparrot.com/) as emojis in your Mattermost instance.

## Getting Started
Use GitHub's template feature to make a copy of this repository by clicking the "Use this template" button.

Alternatively shallow clone the repository matching your plugin name:
```
git clone --depth 1 https://github.com/mattermost/mattermost-plugin-starter-template com.example.my-plugin
```

Note that this project uses [Go modules](https://github.com/golang/go/wiki/Modules). Be sure to locate the project outside of `$GOPATH`.
### Prebuilt

Edit the following files:
1. `plugin.json` with your `id`, `name`, and `description`:
```
{
"id": "com.example.my-plugin",
"name": "My Plugin",
"description": "A plugin to enhance Mattermost."
}
```
Get the latest `.tar.gz` archive from the releases page of this repo and upload it to your Mattermost instance through `System Console -> Plugin Management`.

2. `go.mod` with your Go module path, following the `<hosting-site>/<repository>/<module>` convention:
```
module github.com/example/my-plugin
```
### Build it yourself

3. `.golangci.yml` with your Go module path:
```yml
linters-settings:
# [...]
goimports:
local-prefixes: github.com/example/my-plugin
```
1. Ensure you have `make`, `go` and `golangci`.
1. Clone the repo.
1. Build the plugin:

Build your plugin:
```
make
```
```sh
make
```

This will produce a single plugin file (with support for multiple architectures) for upload to your Mattermost server:

```
dist/com.example.my-plugin.tar.gz
```
`dist/org.polycancer.mattermost-partyparrots-sync-0.1.0.tar.gz`

### Configuration

For now, this plugin requires a Personal Access Token to allow access to the CreateEmoji API.
Hopefully, this can eventually be replaced by self-managed bot account.

## Development

Expand Down Expand Up @@ -109,32 +86,3 @@ export MM_SERVICESETTINGS_SITEURL=http://localhost:8065
export MM_ADMIN_TOKEN=j44acwd8obn78cdcx7koid4jkr
make deploy
```

## Q&A

### How do I make a server-only or web app-only plugin?

Simply delete the `server` or `webapp` folders and remove the corresponding sections from `plugin.json`. The build scripts will skip the missing portions automatically.

### How do I include assets in the plugin bundle?

Place them into the `assets` directory. To use an asset at runtime, build the path to your asset and open as a regular file:

```go
bundlePath, err := p.API.GetBundlePath()
if err != nil {
return errors.Wrap(err, "failed to get bundle path")
}

profileImage, err := ioutil.ReadFile(filepath.Join(bundlePath, "assets", "profile_image.png"))
if err != nil {
return errors.Wrap(err, "failed to read profile image")
}

if appErr := p.API.SetProfileImage(userID, profileImage); appErr != nil {
return errors.Wrap(err, "failed to set profile image")
}
```

### How do I build the plugin with unminified JavaScript?
Setting the `MM_DEBUG` environment variable will invoke the debug builds. The simplist way to do this is to simply include this variable in your calls to `make` (e.g. `make dist MM_DEBUG=1`).
1 change: 0 additions & 1 deletion public/hello.html

This file was deleted.

0 comments on commit fb5ddc5

Please sign in to comment.