|
| 1 | +# ============ |
| 2 | +# Main targets |
| 3 | +# ============ |
| 4 | + |
| 5 | + |
| 6 | +# ------------- |
| 7 | +# Configuration |
| 8 | +# ------------- |
| 9 | + |
| 10 | +$(eval venvpath := .venv_util) |
| 11 | +$(eval pip := $(venvpath)/bin/pip) |
| 12 | +$(eval python := $(venvpath)/bin/python) |
| 13 | +$(eval bumpversion := $(venvpath)/bin/bumpversion) |
| 14 | +$(eval github-release := ./bin/github-release) |
| 15 | + |
| 16 | + |
| 17 | +# ----- |
| 18 | +# Build |
| 19 | +# ----- |
| 20 | +sdist: |
| 21 | + yarn build |
| 22 | + |
| 23 | + |
| 24 | +# ------- |
| 25 | +# Release |
| 26 | +# ------- |
| 27 | + |
| 28 | +# Release this piece of software |
| 29 | +# Synopsis: |
| 30 | +# make release bump=minor (major,minor,patch) |
| 31 | +release: bumpversion push sdist publish-release |
| 32 | + |
| 33 | +prepare-release: |
| 34 | + |
| 35 | + @# Compute release name. |
| 36 | + $(eval name := grafana-worldmap-panel-ng) |
| 37 | + $(eval version := $(shell cat package.json | jq -r .version)) |
| 38 | + $(eval releasename := $(name)-$(version)) |
| 39 | + |
| 40 | + $(eval zipfile := artifacts/$(releasename).zip) |
| 41 | + |
| 42 | +create-release: prepare-release |
| 43 | + |
| 44 | + @echo "Baking release artefacts for $(releasename)" |
| 45 | + |
| 46 | + # Create .zip archive. |
| 47 | + @mkdir -p artifacts |
| 48 | + (cd dist; zip -r ../$(zipfile) *) |
| 49 | + |
| 50 | +publish-release: check-github-release prepare-release create-release |
| 51 | + |
| 52 | + @echo "Uploading release artefacts for $(releasename) to GitHub" |
| 53 | + |
| 54 | + @# Show current releases. |
| 55 | + @#$(github-release) info --user hiveeyes --repo grafana-worldmap-panel |
| 56 | + |
| 57 | + # Create Release. |
| 58 | + @#$(github-release) release --user hiveeyes --repo grafana-worldmap-panel --tag $(version) --draft |
| 59 | + $(github-release) release --user hiveeyes --repo grafana-worldmap-panel --tag $(version) |
| 60 | + |
| 61 | + # Upload release artifacts. |
| 62 | + $(github-release) upload --user hiveeyes --repo grafana-worldmap-panel --tag $(version) --name $(notdir $(zipfile)) --file $(zipfile) --replace |
| 63 | + |
| 64 | + |
| 65 | + |
| 66 | +# =============== |
| 67 | +# Utility targets |
| 68 | +# =============== |
| 69 | +bumpversion: install-releasetools |
| 70 | + @$(bumpversion) $(bump) |
| 71 | + |
| 72 | +push: |
| 73 | + git push && git push --tags |
| 74 | + |
| 75 | +install-releasetools: setup-virtualenv |
| 76 | + @$(pip) install --quiet 'bump2version==0.5.10' --upgrade |
| 77 | + |
| 78 | +check-github-release: |
| 79 | + @test -e $(github-release) || (echo 'ERROR: "github-release" not found.\nPlease install "github-release" to "./bin/github-release".\nSee https://github.com/aktau/github-release\nand check "make install-github-release".'; exit 1) |
| 80 | + |
| 81 | +install-github-release: |
| 82 | + |
| 83 | + # https://github.com/aktau/github-release |
| 84 | + $(eval url := https://github.com/aktau/github-release/releases/download/v0.7.2/darwin-amd64-github-release.tar.bz2) |
| 85 | + |
| 86 | + mkdir -p bin |
| 87 | + #@ cat ~/Downloads/darwin-amd64-github-release.tar.bz2 |
| 88 | + curl $(url) | tar -xj --strip-components=3 -C bin/ bin/darwin/amd64/github-release |
| 89 | + |
| 90 | +# Setup Python virtualenv |
| 91 | +setup-virtualenv: |
| 92 | + @test -e $(python) || `command -v virtualenv` --python=python3 --no-site-packages $(venvpath) |
| 93 | + |
| 94 | + |
| 95 | +# ------- |
| 96 | +# Project |
| 97 | +# ------- |
| 98 | + |
| 99 | +grafana-start: |
| 100 | + # brew install grafana |
| 101 | + grafana-server --config=/usr/local/etc/grafana/grafana.ini --homepath /usr/local/share/grafana cfg:default.paths.logs=/usr/local/var/log/grafana cfg:default.paths.data=/usr/local/var/lib/grafana cfg:default.paths.plugins=/usr/local/var/lib/grafana/plugins |
| 102 | + |
| 103 | +link-plugin: |
| 104 | + # This is also suitable for a Grafana installation on Homebrew |
| 105 | + ln -s `pwd` /usr/local/var/lib/grafana/plugins/grafana-worldmap-panel-ng |
0 commit comments