Skip to content

Fix plugin validation errors #6

Fix plugin validation errors

Fix plugin validation errors #6

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Install Mage
run: go install github.com/magefile/mage@latest
- name: Install frontend dependencies
run: npm ci
- name: Build frontend
run: npm run build
- name: Test frontend
run: npm run test:ci
- name: Preserve frontend build
run: |
# Backend build will clean dist/, so save frontend artifacts
mkdir -p .frontend-backup
cp -r dist/* .frontend-backup/
- name: Build backend
run: mage -v buildAll
- name: Merge frontend and backend builds
run: |
# Copy frontend artifacts back to dist/
cp -r .frontend-backup/* dist/
# Clean up backup
rm -rf .frontend-backup
# Copy one platform's binary to root for validation
# The validator expects to find at least one binary at the root
cp dist/linux_amd64/gpx_arc dist/gpx_arc || true
# Signing disabled - requires Grafana Labs approval for plugin.publisher scope
# Plugin will be distributed as unsigned until officially approved by Grafana
# - name: Sign plugin
# run: npm run sign
# env:
# GRAFANA_ACCESS_POLICY_TOKEN: ${{ secrets.GRAFANA_ACCESS_POLICY_TOKEN }}
# if: ${{ env.GRAFANA_ACCESS_POLICY_TOKEN != '' }}
- name: Get plugin metadata
id: metadata
run: |
sudo apt-get install jq
export GRAFANA_PLUGIN_ID=$(cat dist/plugin.json | jq -r .id)
export GRAFANA_PLUGIN_VERSION=$(cat dist/plugin.json | jq -r .info.version)
export GRAFANA_PLUGIN_TYPE=$(cat dist/plugin.json | jq -r .type)
export GRAFANA_PLUGIN_ARTIFACT=${GRAFANA_PLUGIN_ID}-${GRAFANA_PLUGIN_VERSION}.zip
export GRAFANA_PLUGIN_ARTIFACT_CHECKSUM=${GRAFANA_PLUGIN_ARTIFACT}.md5
echo "plugin-id=${GRAFANA_PLUGIN_ID}" >> $GITHUB_OUTPUT
echo "plugin-version=${GRAFANA_PLUGIN_VERSION}" >> $GITHUB_OUTPUT
echo "plugin-type=${GRAFANA_PLUGIN_TYPE}" >> $GITHUB_OUTPUT
echo "archive=${GRAFANA_PLUGIN_ARTIFACT}" >> $GITHUB_OUTPUT
echo "archive-checksum=${GRAFANA_PLUGIN_ARTIFACT_CHECKSUM}" >> $GITHUB_OUTPUT
echo "github-tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Package plugin
id: package-plugin
run: |
mv dist ${{ steps.metadata.outputs.plugin-id }}
zip ${{ steps.metadata.outputs.archive }} ${{ steps.metadata.outputs.plugin-id }} -r
md5sum ${{ steps.metadata.outputs.archive }} > ${{ steps.metadata.outputs.archive-checksum }}
echo "checksum=$(cat ./${{ steps.metadata.outputs.archive-checksum }} | cut -d' ' -f1)" >> $GITHUB_OUTPUT
- name: Validate plugin
run: |
git clone https://github.com/grafana/plugin-validator
pushd ./plugin-validator/pkg/cmd/plugincheck2
go install
popd
plugincheck2 -config ./plugin-validator/config/default.yaml ${{ steps.metadata.outputs.archive }}
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
draft: true
generate_release_notes: true
files: |
./${{ steps.metadata.outputs.archive }}
./${{ steps.metadata.outputs.archive-checksum }}
body: |
**This is a draft release. Please update the release notes before publishing.**
## Installation
Download and extract the plugin archive to your Grafana plugins directory:
```bash
wget https://github.com/basekick-labs/grafana-arc-datasource/releases/download/${{ steps.metadata.outputs.github-tag }}/${{ steps.metadata.outputs.archive }}
unzip ${{ steps.metadata.outputs.archive }} -d /var/lib/grafana/plugins/
systemctl restart grafana-server
```
## What's Changed
See CHANGELOG.md for details.
## Checksums
- MD5: `${{ steps.package-plugin.outputs.checksum }}`