updates for 2.1.0 #92
Workflow file for this run
This file contains 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: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
grafana-version: [8.4.7] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: NodeJS Setup | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.18.0 | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Cache yarn cache | |
uses: actions/cache@v3 | |
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@v3 | |
with: | |
path: | | |
~/.cache/Cypress | |
node_modules | |
key: ${{ runner.os }}-16.18.0-nodemodules-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-16.18.0-nodemodules- | |
- name: Install dependencies | |
run: CYPRESS_CACHE_FOLDER=/home/runner/.cache/Cypress yarn install --frozen-lockfile; | |
if: | | |
steps.cache-yarn-cache.outputs.cache-hit != 'true' || | |
steps.cache-node-modules.outputs.cache-hit != 'true' | |
- name: Audit for vulnerabilities | |
run: | | |
yarn audit-ci; | |
- name: Spellcheck | |
run: | | |
yarn spellcheck; | |
- name: Build Frontend | |
run: | | |
NODE_OPTIONS=--max_old_space_size=8192 yarn ci-build; | |
- name: Setup Go environment | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21.3' | |
- name: Get go cache directory path | |
id: go-cache-paths | |
run: echo "::set-output name=go-mod::$(go env GOMODCACHE)" | |
- name: Go Mod Cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.go-cache-paths.outputs.go-mod }} | |
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }} | |
- name: Test backend | |
uses: magefile/mage-action@v2 | |
with: | |
version: latest | |
args: coverage | |
- name: Build backend | |
uses: magefile/mage-action@v2 | |
with: | |
version: latest | |
args: buildAll | |
- name: Start the docker container for e2e | |
run: | | |
docker-compose pull | |
docker-compose up -d | |
- name: wait for grafana to start | |
uses: nev7n/wait_for_response@v1 | |
with: | |
url: 'http://localhost:3000/' | |
responseCode: 200 | |
timeout: 20000 | |
interval: 500 | |
- name: Run E2E | |
run: yarn e2e | |
- name: Stop the docker container | |
if: always() | |
run: docker-compose down | |
- name: Sign plugin | |
run: yarn 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 |