diff --git a/.gitignore b/.gitignore index b8fc006..ec40851 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ node_modules npm-debug.log +yarn-error.log .DS_Store .vscode .idea @@ -9,6 +10,5 @@ coverage/ artifacts/ .venv* -bin/ build/ ci/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77e768e..e24fc1c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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`. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0e96aa1 --- /dev/null +++ b/Makefile @@ -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)