Skip to content

Commit 9d25da1

Browse files
committed
Merge branch 'develop' into main
2 parents a8d882e + a91370a commit 9d25da1

18 files changed

+1749
-1310
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
workflow_dispatch:
55
push:
66
branches:
7-
- master
87
- develop
98
pull_request:
109
branches:
@@ -58,7 +57,7 @@ jobs:
5857
if: steps.check-for-backend.outputs.has-backend == 'true'
5958
uses: actions/setup-go@v2
6059
with:
61-
go-version: '1.15'
60+
go-version: '1.17'
6261

6362
- name: Test backend
6463
if: steps.check-for-backend.outputs.has-backend == 'true'
@@ -71,5 +70,6 @@ jobs:
7170
if: steps.check-for-backend.outputs.has-backend == 'true'
7271
uses: magefile/mage-action@v1
7372
with:
74-
version: v1.11.0
73+
version: v1.12.1
7574
args: buildAll
75+

.github/workflows/release.yml

Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
15+
- name: Setup Node.js environment
16+
uses: actions/[email protected]
17+
with:
18+
node-version: '14.x'
19+
20+
- name: Setup Go environment
21+
uses: actions/setup-go@v2
22+
with:
23+
go-version: '1.17'
24+
25+
- name: Get yarn cache directory path
26+
id: yarn-cache-dir-path
27+
run: echo "::set-output name=dir::$(yarn cache dir)"
28+
29+
- name: Cache yarn cache
30+
uses: actions/cache@v2
31+
id: cache-yarn-cache
32+
with:
33+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
34+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
35+
restore-keys: |
36+
${{ runner.os }}-yarn-
37+
- name: Cache node_modules
38+
id: cache-node-modules
39+
uses: actions/cache@v2
40+
with:
41+
path: node_modules
42+
key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
43+
restore-keys: |
44+
${{ runner.os }}-${{ matrix.node-version }}-nodemodules-
45+
- name: Install dependencies
46+
run: yarn install --frozen-lockfile;
47+
if: |
48+
steps.cache-yarn-cache.outputs.cache-hit != 'true' ||
49+
steps.cache-node-modules.outputs.cache-hit != 'true'
50+
- name: Build and test frontend
51+
run: yarn build
52+
53+
- name: Check for backend
54+
id: check-for-backend
55+
run: |
56+
if [ -f "Magefile.go" ]
57+
then
58+
echo "::set-output name=has-backend::true"
59+
fi
60+
- name: Test backend
61+
if: steps.check-for-backend.outputs.has-backend == 'true'
62+
uses: magefile/mage-action@v1
63+
with:
64+
version: latest
65+
args: coverage
66+
67+
- name: Build backend
68+
if: steps.check-for-backend.outputs.has-backend == 'true'
69+
uses: magefile/mage-action@v1
70+
with:
71+
version: latest
72+
args: buildAll
73+
74+
- name: Sign plugin
75+
run: yarn sign
76+
env:
77+
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }} # Requires a Grafana API key from Grafana.com.
78+
79+
- name: Get plugin metadata
80+
id: metadata
81+
run: |
82+
sudo apt-get install jq
83+
export GRAFANA_PLUGIN_ID=$(cat dist/plugin.json | jq -r .id)
84+
export GRAFANA_PLUGIN_VERSION=$(cat dist/plugin.json | jq -r .info.version)
85+
export GRAFANA_PLUGIN_TYPE=$(cat dist/plugin.json | jq -r .type)
86+
export GRAFANA_PLUGIN_ARTIFACT=${GRAFANA_PLUGIN_ID}-${GRAFANA_PLUGIN_VERSION}.zip
87+
export GRAFANA_PLUGIN_ARTIFACT_CHECKSUM=${GRAFANA_PLUGIN_ARTIFACT}.md5
88+
echo "::set-output name=plugin-id::${GRAFANA_PLUGIN_ID}"
89+
echo "::set-output name=plugin-version::${GRAFANA_PLUGIN_VERSION}"
90+
echo "::set-output name=plugin-type::${GRAFANA_PLUGIN_TYPE}"
91+
echo "::set-output name=archive::${GRAFANA_PLUGIN_ARTIFACT}"
92+
echo "::set-output name=archive-checksum::${GRAFANA_PLUGIN_ARTIFACT_CHECKSUM}"
93+
echo ::set-output name=github-tag::${GITHUB_REF#refs/*/}
94+
- name: Read changelog
95+
id: changelog
96+
run: |
97+
awk '/^## / {s++} s == 1 {print}' CHANGELOG.md > release_notes.md
98+
echo "::set-output name=path::release_notes.md"
99+
- name: Check package version
100+
run: if [ "v${{ steps.metadata.outputs.plugin-version }}" != "${{ steps.metadata.outputs.github-tag }}" ]; then printf "\033[0;31mPlugin version doesn't match tag name\033[0m\n"; exit 1; fi
101+
102+
- name: Package plugin
103+
id: package-plugin
104+
run: |
105+
mv dist ${{ steps.metadata.outputs.plugin-id }}
106+
zip ${{ steps.metadata.outputs.archive }} ${{ steps.metadata.outputs.plugin-id }} -r
107+
md5sum ${{ steps.metadata.outputs.archive }} > ${{ steps.metadata.outputs.archive-checksum }}
108+
echo "::set-output name=checksum::$(cat ./${{ steps.metadata.outputs.archive-checksum }} | cut -d' ' -f1)"
109+
- name: Lint plugin
110+
run: |
111+
git clone https://github.com/grafana/plugin-validator
112+
pushd ./plugin-validator/pkg/cmd/plugincheck
113+
go install
114+
popd
115+
plugincheck ${{ steps.metadata.outputs.archive }}
116+
- name: Create release
117+
id: create_release
118+
uses: actions/create-release@v1
119+
env:
120+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
with:
122+
tag_name: ${{ github.ref }}
123+
release_name: Release ${{ github.ref }}
124+
body_path: ${{ steps.changelog.outputs.path }}
125+
draft: true
126+
127+
- name: Add plugin to release
128+
id: upload-plugin-asset
129+
uses: actions/upload-release-asset@v1
130+
env:
131+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132+
with:
133+
upload_url: ${{ steps.create_release.outputs.upload_url }}
134+
asset_path: ./${{ steps.metadata.outputs.archive }}
135+
asset_name: ${{ steps.metadata.outputs.archive }}
136+
asset_content_type: application/zip
137+
138+
- name: Add checksum to release
139+
id: upload-checksum-asset
140+
uses: actions/upload-release-asset@v1
141+
env:
142+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
143+
with:
144+
upload_url: ${{ steps.create_release.outputs.upload_url }}
145+
asset_path: ./${{ steps.metadata.outputs.archive-checksum }}
146+
asset_name: ${{ steps.metadata.outputs.archive-checksum }}
147+
asset_content_type: text/plain
148+
149+
- name: Publish to Grafana.com
150+
run: |
151+
echo A draft release has been created for your plugin. Please review and publish it. Then submit your plugin to grafana.com/plugins by opening a PR to https://github.com/grafana/grafana-plugin-repository with the following entry:
152+
echo
153+
echo '{ "id": "${{ steps.metadata.outputs.plugin-id }}", "type": "${{ steps.metadata.outputs.plugin-type }}", "url": "https://github.com/${{ github.repository }}", "versions": [ { "version": "${{ steps.metadata.outputs.plugin-version }}", "commit": "${{ github.sha }}", "url": "https://github.com/${{ github.repository }}", "download": { "any": { "url": "https://github.com/${{ github.repository }}/releases/download/v${{ steps.metadata.outputs.plugin-version }}/${{ steps.metadata.outputs.archive }}", "md5": "${{ steps.package-plugin.outputs.checksum }}" } } } ] }' | jq .

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ e2e-results/
2828

2929
# Editor
3030
.idea
31+
32+
# Plugin Validator
33+
golioth-websocket-datasource/
34+
golioth-websocket-datasource.zip

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Changelog
22

3-
## 1.0.0 (Unreleased)
3+
## 1.0.0
44

5-
Initial release.
5+
Golioth's WebSocket Data Source Plugin Launch
6+
7+
The main focus on this release is to launch the new websocket data source plugin for the Grafana Community.

0 commit comments

Comments
 (0)