From b658b562e88033c6bfc89ebd0062caeab9dbf8fd Mon Sep 17 00:00:00 2001 From: Andres Martinez Gotor Date: Thu, 8 Feb 2024 14:54:42 +0100 Subject: [PATCH] Chore: Allow standalone release for core plugins without a backend (#82157) --- .../core-plugins-build-and-release.yml | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/core-plugins-build-and-release.yml b/.github/workflows/core-plugins-build-and-release.yml index 540520a0665..a385637e9b8 100644 --- a/.github/workflows/core-plugins-build-and-release.yml +++ b/.github/workflows/core-plugins-build-and-release.yml @@ -199,8 +199,7 @@ jobs: gsutil -m cp -r ci/packages/*darwin* gs://${{ env.GCP_BUCKET }}/${{ inputs.plugin_id }}/release/${VERSION}/darwin gsutil -m cp -r ci/packages/*any* gs://${{ env.GCP_BUCKET }}/${{ inputs.plugin_id }}/release/${VERSION}/any - name: Publish new plugin version on grafana.com - # TODO: This assumes that there are packages for all platforms - # which is not true for frontend only plugins + if: steps.check_backend.outputs.has_backend == 'true' working-directory: ${{ steps.get_dir.outputs.dir }} env: GCOM_TOKEN: ${{ env.PLUGINS_GCOM_TOKEN }} @@ -241,4 +240,27 @@ jobs: echo "Failed to publish plugin version. Got:" echo $result exit 1 - fi \ No newline at end of file + fi + - name: Publish new plugin version on grafana.com (frontend only) + if: steps.check_backend.outputs.has_backend == 'false' + working-directory: ${{ steps.get_dir.outputs.dir }} + env: + GCOM_TOKEN: ${{ env.PLUGINS_GCOM_TOKEN }} + VERSION: ${{ steps.build_frontend.outputs.version }} + run: | + echo "Publish new plugin version on grafana.com:" + echo "Plugin version: ${VERSION}" + result=`curl -H "Authorization: Bearer $GCOM_TOKEN" -H "Content-Type: application/json" ${{ env.GCOM_API}}/api/plugins -d "{ + \"url\": \"https://github.com/grafana/grafana/tree/main/${{ steps.get_dir.outputs.dir }}\", + \"download\": { + \"any\": { + \"url\": \"https://storage.googleapis.com/${{ env.GCP_BUCKET }}/${{ inputs.plugin_id }}/release/${VERSION}/any/${{ inputs.plugin_id }}-${VERSION}.any.zip\", + \"md5\": \"$(cat ci/packages/info-any.json | jq -r .plugin.md5)\" + } + } + }"` + if [[ "$(echo $result | jq -r .version)" == "null" ]]; then + echo "Failed to publish plugin version. Got:" + echo $result + exit 1 + fi