Skip to content

Commit 2c00838

Browse files
authored
Fix Grafana plugin release job (#107)
* 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]>
1 parent b26e011 commit 2c00838

File tree

1 file changed

+12
-33
lines changed

1 file changed

+12
-33
lines changed

.github/workflows/release.yml

+12-33
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ on:
88
jobs:
99
release:
1010
runs-on: ubuntu-latest
11-
11+
permissions:
12+
contents: write
1213
steps:
1314
- uses: actions/checkout@v2
1415

@@ -108,46 +109,24 @@ jobs:
108109
echo "::set-output name=checksum::$(cat ./${{ steps.metadata.outputs.archive-checksum }} | cut -d' ' -f1)"
109110
- name: Lint plugin
110111
run: |
111-
git clone https://github.com/grafana/plugin-validator
112-
pushd ./plugin-validator/pkg/cmd/plugincheck
112+
# TODO(ddelnano): This should be removed once Go is upgraded to 1.21 or later
113+
# This will also likely change when https://github.com/pixie-io/grafana-plugin/issues/106
114+
# is resolved
115+
git clone --branch v0.7.1 --depth 1 https://github.com/grafana/plugin-validator
116+
pushd ./plugin-validator/pkg/cmd/plugincheck2
113117
go install
114118
popd
115-
plugincheck ${{ steps.metadata.outputs.archive }}
119+
plugincheck2 ${{ steps.metadata.outputs.archive }}
116120
- name: Create release
117121
id: create_release
118-
uses: actions/create-release@v1
122+
uses: softprops/action-gh-release@v2
119123
env:
120124
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121125
with:
122126
tag_name: ${{ github.ref }}
123127
release_name: Release ${{ github.ref }}
124128
body_path: ${{ steps.changelog.outputs.path }}
129+
files: |
130+
${{ steps.metadata.outputs.archive }}
131+
${{ steps.metadata.outputs.archive-checksum }}
125132
draft: true
126-
127-
- name: Add plugin to release
128-
id: upload-plugin-asset
129-
uses: actions/upload-release-asset@v1
130-
env:
131-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132-
with:
133-
upload_url: ${{ steps.create_release.outputs.upload_url }}
134-
asset_path: ./${{ steps.metadata.outputs.archive }}
135-
asset_name: ${{ steps.metadata.outputs.archive }}
136-
asset_content_type: application/zip
137-
138-
- name: Add checksum to release
139-
id: upload-checksum-asset
140-
uses: actions/upload-release-asset@v1
141-
env:
142-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
143-
with:
144-
upload_url: ${{ steps.create_release.outputs.upload_url }}
145-
asset_path: ./${{ steps.metadata.outputs.archive-checksum }}
146-
asset_name: ${{ steps.metadata.outputs.archive-checksum }}
147-
asset_content_type: text/plain
148-
149-
- name: Publish to Grafana.com
150-
run: |
151-
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:
152-
echo
153-
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 commit comments

Comments
 (0)