diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a3b6ef1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,129 @@ +# This is a basic workflow to help you get started with Actions + +name: release + +# Controls when the workflow will run +on: + # Triggers the workflow on push tag events but only for the "main" branch + push: + tags: + - 'v*.*.*' # Run workflow on version tags, e.g. v1.0.0. + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + release: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + + - name: Set Node.js 16.x + uses: actions/setup-node@v3 + with: + node-version: '16' + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT + + - name: Cache yarn cache + uses: actions/cache@v2 + id: cache-yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Cache node_modules + id: cache-node-modules + uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.os }}-${{ matrix.node-version }}-nodemodules-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.node-version }}-nodemodules- + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Build and test frontend + run: yarn build + + - name: Sign plugin + run: yarn sign + env: + GRAFANA_API_KEY: ${{ secrets.GRAFANA_API_KEY }} # Requires a Grafana API key from Grafana.com. + + - 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 + + - name: Read changelog + id: changelog + run: | + awk '/^## / {s++} s == 1 {print}' CHANGELOG.md > release_notes.md + echo "path=release_notes.md" >> $GITHUB_OUTPUT + + - name: Package plugin + id: package-plugin + run: | + cp README.md dist/README.md + 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: 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 }} + body_path: ${{ steps.changelog.outputs.path }} + #draft: true + draft: 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: ./${{ steps.metadata.outputs.archive }} + asset_name: ${{ steps.metadata.outputs.archive }} + 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: ./${{ steps.metadata.outputs.archive-checksum }} + asset_name: ${{ steps.metadata.outputs.archive-checksum }} + asset_content_type: text/plain diff --git a/CHANGELOG.md b/CHANGELOG.md index b35f2ec..3fcaa28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ # Changelog -## 1.1.0 (Unreleased) +## 1.0.3 (release) + +add workflow + +## 1.0.2 (release) + +release file modify + +## 1.0.1 (Unreleased) Add Some Options diff --git a/LICENSE b/LICENSE index 2cb5acc..3669492 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 Arnaud Marchand +Copyright (c) 2023 Mesak Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 5a77f52..d54bd58 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,11 @@ # Image Save Panel Plugin for Grafana +[![Marketplace](https://img.shields.io/badge/dynamic/json?logo=grafana&color=F47A20&label=marketplace&prefix=v&query=%24.items%5B%3F%28%40.slug%20%3D%3D%20%22mesak-imagesave-panel%22%29%5D.version&url=https%3A%2F%2Fgrafana.com%2Fapi%2Fplugins)](https://grafana.com/grafana/plugins/mesak-imagesave-panel) +[![Downloads](https://img.shields.io/badge/dynamic/json?logo=grafana&color=F47A20&label=downloads&query=%24.items%5B%3F%28%40.slug%20%3D%3D%20%22mesak-imagesave-panel%22%29%5D.downloads&url=https%3A%2F%2Fgrafana.com%2Fapi%2Fplugins)](https://grafana.com/grafana/plugins/mesak-imagesave-panel) + +[![GitHub release (latest by date)](https://img.shields.io/github/v/release/mesak/grafana-imagesave-panel?color=brightgreen&logo=github&label=latest)](https://github.com/mesak/grafana-imagesave-panel) +[![License](https://img.shields.io/github/license/mesak/grafana-imagesave-panel)](https://github.com/mesak/grafana-imagesave-panel/blob/master/LICENSE) + This plugin is a panel plugin for Grafana that allows you to save image to grafana. ## Installation @@ -23,3 +29,4 @@ This plugin directly stores image data in Grafana Database, allowing for quick a ## Screenshots ![Screenshot](https://raw.githubusercontent.com/mesak/grafana-imagesave-panel/main/src/img/screenshot.jpg) + diff --git a/build.sh b/build.sh deleted file mode 100644 index f609280..0000000 --- a/build.sh +++ /dev/null @@ -1,7 +0,0 @@ -rm -f dist release/mesak-imagesave-panel.zip release/mesak-imagesave-panel.sha1 -yarn build -npx @grafana/sign-plugin@latest -mv dist mesak-imagesave-panel -zip -r release/mesak-imagesave-panel.zip mesak-imagesave-panel -mv mesak-imagesave-panel dist -sha1sum release/mesak-imagesave-panel.zip > release/mesak-imagesave-panel.sha1 diff --git a/package.json b/package.json index bc2065e..aa54dbb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mesak-imagesave-panel", - "version": "1.0.2", + "version": "1.0.3", "description": "Image Save Panel Plugin for Grafana", "scripts": { "build": "grafana-toolkit plugin:build", diff --git a/release/mesak-imagesave-panel.sha1 b/release/mesak-imagesave-panel.sha1 deleted file mode 100644 index 97c86d2..0000000 --- a/release/mesak-imagesave-panel.sha1 +++ /dev/null @@ -1 +0,0 @@ -7b3fb2672f9d747ce86a42fd18272a1544613213 release/mesak-imagesave-panel.zip diff --git a/release/mesak-imagesave-panel.zip b/release/mesak-imagesave-panel.zip deleted file mode 100644 index 344e6e9..0000000 Binary files a/release/mesak-imagesave-panel.zip and /dev/null differ