Skip to content

Build by Github Actions #12

Build by Github Actions

Build by Github Actions #12

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: NodeJS Setup
uses: actions/setup-node@v1
with:
node-version: 16.x
- name: Dependencies Install
run: |
echo "Grafana Boom Table plugin - Install dependencies";
yarn install --frozen-lockfile;
- name: Test
run: |
echo "Grafana Boom Table plugin - Test";
yarn test;
- name: Build
run: |
echo "Grafana Boom Table plugin - Build";
yarn build;
- name: Sign plugin
run: npx @grafana/[email protected] plugin:sign
env:
GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }}
- name: Get plugin information
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 "GRAFANA_PLUGIN_ID=${GRAFANA_PLUGIN_ID}" >> $GITHUB_ENV
echo "GRAFANA_PLUGIN_VERSION=${GRAFANA_PLUGIN_VERSION}" >> $GITHUB_ENV
echo "GRAFANA_PLUGIN_TYPE=${GRAFANA_PLUGIN_TYPE}" >> $GITHUB_ENV
echo "GRAFANA_PLUGIN_ARTIFACT=${GRAFANA_PLUGIN_ARTIFACT}" >> $GITHUB_ENV
echo "GRAFANA_PLUGIN_ARTIFACT_CHECKSUM=${GRAFANA_PLUGIN_ARTIFACT_CHECKSUM}" >> $GITHUB_ENV
- name: Package plugin
run: |
mv dist $GRAFANA_PLUGIN_ID
zip $GRAFANA_PLUGIN_ARTIFACT $GRAFANA_PLUGIN_ID -r
md5sum $GRAFANA_PLUGIN_ARTIFACT > $GRAFANA_PLUGIN_ARTIFACT_CHECKSUM
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Add plugin to release
id: upload-plugin-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.GRAFANA_PLUGIN_ARTIFACT }}
asset_name: ${{ env.GRAFANA_PLUGIN_ARTIFACT }}
asset_content_type: application/zip
- name: Add checksum to release
id: upload-checksum-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.GRAFANA_PLUGIN_ARTIFACT_CHECKSUM }}
asset_name: ${{ env.GRAFANA_PLUGIN_ARTIFACT_CHECKSUM }}
asset_content_type: text/plain