Skip to content

Commit

Permalink
Add Makefile to assist in packaging and publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Dec 6, 2020
1 parent c8681a5 commit 3a7dc70
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
npm-debug.log
yarn-error.log
.DS_Store
.vscode
.idea
Expand All @@ -9,6 +10,5 @@ coverage/
artifacts/

.venv*
bin/
build/
ci/
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ refreshing the page will be sufficient.
7. Create zip package: `npx grafana-toolkit plugin:ci-package`
When this process succeeds, packages can be found within the `ci/packages/` folder.
The `Error signing manifest` warning can optionally be ignored, YMMV.

Steps 6. and 7. can be shortened by invoking `make package publish`.
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# ===================
# Package and publish
# ===================

package:
npx grafana-toolkit plugin:ci-build
npx grafana-toolkit plugin:ci-build --finish
npx grafana-toolkit plugin:ci-package

publish: check-tools check-token

@# Before running this, export your GitHub access token.
@#export GITHUB_TOKEN=8542f7c47b1697a79ab7f105e1d79f054d0b5599

@# Read version from "package.json".
$(eval version=$(shell cat package.json | jq --raw-output .version))

@# Create release on GitHub.
github-release release --user panodata --repo grafana-map-panel --tag $(version) || true

@# Upload distribution package.
$(eval distfile=ci/packages/grafana-map-panel-$(version).zip)
github-release upload --user panodata --repo grafana-map-panel --tag $(version) --name $(notdir $(distfile)) --file $(distfile)


check-tools:
@jq --version >/dev/null 2>&1 || (echo 'ERROR: "jq" not found. Please install using "brew install jq" or download from https://github.com/stedolan/jq/releases.' && exit 1)
@github-release --version >/dev/null 2>&1 || (echo 'ERROR: "github-release" not found. Please install using "brew install github-release" or download from https://github.com/github-release/github-release/releases.' && exit 1)

check-token:
@test -n "$(GITHUB_TOKEN)" || (echo 'ERROR: GITHUB_TOKEN environment variable not set.' && exit 1)

0 comments on commit 3a7dc70

Please sign in to comment.