Refactor: Move grafana publish actions and scripts to dev-health-panels #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test Grafana Plugin | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| test-plugin: | |
| name: Test and Validate Plugin | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci --legacy-peer-deps | |
| - name: Lint | |
| run: npm run lint | |
| - name: Typecheck | |
| run: npm run typecheck | |
| - name: Run Tests | |
| run: npm run test:ci | |
| - name: Build Plugin | |
| run: npm run build | |
| - name: Get Plugin Metadata | |
| id: metadata | |
| run: | | |
| PLUGIN_ID=$(jq -r .id src/plugin.json) | |
| VERSION=$(cat dist/plugin.json | jq -r .info.version) | |
| echo "plugin_id=$PLUGIN_ID" >> "$GITHUB_OUTPUT" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Package Plugin for Validation | |
| run: | | |
| PLUGIN_ID="${{ steps.metadata.outputs.plugin_id }}" | |
| VERSION="${{ steps.metadata.outputs.version }}" | |
| mv dist "$PLUGIN_ID" | |
| zip -r "$PLUGIN_ID-$VERSION.zip" "$PLUGIN_ID" | |
| - name: Validate Plugin | |
| run: | | |
| PLUGIN_ID="${{ steps.metadata.outputs.plugin_id }}" | |
| VERSION="${{ steps.metadata.outputs.version }}" | |
| npx @grafana/plugin-validator@latest "$PLUGIN_ID-$VERSION.zip" |