Skip to content

Commit

Permalink
Fix Grafana plugin release job (#107)
Browse files Browse the repository at this point in the history
* Pin grafana/plugin-validator to v0.6.2 before go1.18 incompatibilites were introduced

Signed-off-by: Dom Del Nano <[email protected]>

* Try another version of plugin-validator

Signed-off-by: Dom Del Nano <[email protected]>

* Use plugincheck2

Signed-off-by: Dom Del Nano <[email protected]>

* Ensure action has permission to write to GH release

Signed-off-by: Dom Del Nano <[email protected]>

* Use softprops/action-gh-release

Signed-off-by: Dom Del Nano <[email protected]>
  • Loading branch information
ddelnano authored Dec 6, 2024
1 parent b26e011 commit 2c00838
Showing 1 changed file with 12 additions and 33 deletions.
45 changes: 12 additions & 33 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ on:
jobs:
release:
runs-on: ubuntu-latest

permissions:
contents: write
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -108,46 +109,24 @@ jobs:
echo "::set-output name=checksum::$(cat ./${{ steps.metadata.outputs.archive-checksum }} | cut -d' ' -f1)"
- name: Lint plugin
run: |
git clone https://github.com/grafana/plugin-validator
pushd ./plugin-validator/pkg/cmd/plugincheck
# TODO(ddelnano): This should be removed once Go is upgraded to 1.21 or later
# This will also likely change when https://github.com/pixie-io/grafana-plugin/issues/106
# is resolved
git clone --branch v0.7.1 --depth 1 https://github.com/grafana/plugin-validator
pushd ./plugin-validator/pkg/cmd/plugincheck2
go install
popd
plugincheck ${{ steps.metadata.outputs.archive }}
plugincheck2 ${{ steps.metadata.outputs.archive }}
- name: Create release
id: create_release
uses: actions/create-release@v1
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body_path: ${{ steps.changelog.outputs.path }}
files: |
${{ steps.metadata.outputs.archive }}
${{ steps.metadata.outputs.archive-checksum }}
draft: true

- 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

- name: Publish to Grafana.com
run: |
echo A draft release has been created for your plugin. Please review and publish it. Then submit your plugin to grafana.com/plugins by opening a PR to https://github.com/grafana/grafana-plugin-repository with the following entry:
echo
echo '{ "id": "${{ steps.metadata.outputs.plugin-id }}", "type": "${{ steps.metadata.outputs.plugin-type }}", "url": "https://github.com/${{ github.repository }}", "versions": [ { "version": "${{ steps.metadata.outputs.plugin-version }}", "commit": "${{ github.sha }}", "url": "https://github.com/${{ github.repository }}", "download": { "any": { "url": "https://github.com/${{ github.repository }}/releases/download/v${{ steps.metadata.outputs.plugin-version }}/${{ steps.metadata.outputs.archive }}", "md5": "${{ steps.package-plugin.outputs.checksum }}" } } } ] }' | jq .

0 comments on commit 2c00838

Please sign in to comment.