Create Plugin Update #14
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: Check and Update Create Plugin configs | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
check_for_updates: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
- name: Get latest version of the package | |
id: get-latest-version | |
run: echo "LATEST_VERSION=$(npx -y @grafana/create-plugin@latest version)" >> "$GITHUB_ENV" | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PAT_TOKEN }} | |
- name: Get version from .config/.cprc.json | |
id: get-config-version | |
run: | | |
CONFIG_VERSION=$(jq -r '.version' .config/.cprc.json) | |
echo "CONFIG_VERSION=${CONFIG_VERSION}" >> "$GITHUB_ENV" | |
- name: Compare versions | |
id: compare-versions | |
run: | | |
if [ "$LATEST_VERSION" != "$CONFIG_VERSION" ]; then | |
echo "update_needed=true" >> $GITHUB_OUTPUT | |
else | |
echo "update_needed=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Update the configs | |
if: steps.compare-versions.outputs.update_needed == 'true' | |
run: | | |
npx -y @grafana/create-plugin@latest update | |
npm install | |
- name: Create PR | |
uses: peter-evans/create-pull-request@v6 | |
if: steps.compare-versions.outputs.update_needed == 'true' | |
with: | |
token: ${{ secrets.GH_PAT_TOKEN }} | |
branch: update-grafana-create-plugin-${{ env.LATEST_VERSION }} | |
delete-branch: true | |
commit-message: 'chore: run create-plugin update for version ${{ env.LATEST_VERSION }} [skip-ci]' | |
title: 'Update Grafana Create Plugin configs to ${{ env.LATEST_VERSION }}' | |
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | |
body: | | |
This PR updates the Grafana create-plugin configurations to version ${{ env.LATEST_VERSION }}. | |
Please review the changes thoroughly before merging. |