Skip to content

Commit 630563e

Browse files
authored
Actions: Fix grafana-com JSON construction (#672)
1 parent d5a7e44 commit 630563e

File tree

3 files changed

+63
-14
lines changed

3 files changed

+63
-14
lines changed

.github/workflows/build-plugin.yaml

Lines changed: 57 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
- run: yarn run build
4141

4242
- name: Package
43-
run: ./scripts/package_target.sh ${{ matrix.target }} false ${{ matrix.target }}/
43+
run: ./scripts/package_target.sh ${{ matrix.target }} false plugin-${{ matrix.target }}/
4444

4545
- name: Acquire Grafana API key
4646
id: grafana_api_key
@@ -49,25 +49,23 @@ jobs:
4949
repo_secrets: |
5050
GRAFANA_ACCESS_POLICY_TOKEN=gcom-token:token
5151
- name: Sign package
52-
run: yarn sign-plugin --distDir ./dist/${{ matrix.target }}/
52+
run: yarn sign-plugin --distDir ./dist/plugin-${{ matrix.target }}/
5353

5454
- name: Create ZIP
5555
working-directory: dist/
56-
run: zip -yqr ${{ matrix.target }}.zip ${{ matrix.target }}/
56+
run: zip -yqr plugin-${{ matrix.target }}.zip plugin-${{ matrix.target }}/
5757
- name: Upload artifact
5858
uses: actions/upload-artifact@v4
5959
with:
60-
name: ${{ matrix.target }}.zip
61-
path: dist/${{ matrix.target }}.zip
60+
name: plugin-${{ matrix.target }}.zip
61+
path: dist/plugin-${{ matrix.target }}.zip
6262

63-
release:
63+
generate:
6464
needs: build
65-
if: github.event_name == 'push' && github.ref_type == 'tag'
66-
name: Release plugin
65+
name: Generate plugin metadata
6766
runs-on: ubuntu-latest
6867
permissions:
69-
contents: write # create a release
70-
id-token: write # required to read secrets
68+
contents: read # clone the repository
7169
steps:
7270
- uses: actions/checkout@v4
7371
with:
@@ -77,10 +75,11 @@ jobs:
7775
with:
7876
merge-multiple: true
7977
path: artifacts/
78+
pattern: plugin-*.zip
79+
8080
# FIXME: Why do we use MD5?? Why not SHA-2/SHA-512?
8181
- name: Generate MD5 sums
8282
run: ./scripts/generate_md5sum.sh artifacts/
83-
8483
- name: Create Gcom API plugin JSON payload
8584
env:
8685
COMMIT: ${{ github.sha }}
@@ -90,7 +89,52 @@ jobs:
9089
cat artifacts/md5sums.txt | jq --slurp --raw-input \
9190
--arg commit "$COMMIT" \
9291
--arg baseUrl "$BASE_URL" \
93-
'split("\n")[:-1] | map(split(" ")) | map({(.[1] | sub("^artifacts/"; "")): .[0]}) | add | { commit: $commit, url: $baseUrl, download: .}' | tee gcom.json
92+
'split("\n")[:-1]
93+
| map(split(" "))
94+
| map({
95+
(
96+
.[1]
97+
| sub("^artifacts/"; "")
98+
| sub(".zip$"; "")
99+
| sub("plugin-"; "")
100+
| sub("win32"; "windows")
101+
| sub("x64"; "amd64")
102+
| sub("-unknown"; "")
103+
| sub("-glibc"; "")
104+
): .[0]
105+
})
106+
| add
107+
| { commit: $commit, url: $baseUrl, download: .}' | tee gcom.json
108+
- name: Upload generated artifacts
109+
uses: actions/upload-artifact@v4
110+
with:
111+
name: generated-artifacts
112+
path: |
113+
gcom.json
114+
artifacts/md5sums.txt
115+
116+
release:
117+
needs: [build, generate]
118+
if: github.event_name == 'push' && github.ref_type == 'tag'
119+
name: Release plugin
120+
runs-on: ubuntu-latest
121+
permissions:
122+
contents: write # create a release
123+
id-token: write # required to read secrets
124+
steps:
125+
- uses: actions/checkout@v4
126+
with:
127+
persist-credentials: false
128+
129+
- uses: actions/download-artifact@v4
130+
with:
131+
merge-multiple: true
132+
path: artifacts/
133+
pattern: plugin-*.zip
134+
135+
- uses: actions/download-artifact@v4
136+
with:
137+
name: generated-artifacts
94138

95139
- name: Acquire Grafana API key
96140
id: grafana_api_key
@@ -103,7 +147,7 @@ jobs:
103147
with:
104148
files: |
105149
artifacts/*.zip
106-
artifacts/md5sums.txt
150+
md5sums.txt
107151
fail_on_unmatched_files: true
108152
make_latest: 'true'
109153
generate_release_notes: true

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 4.0.1 (2025-07-22)
2+
3+
This release only touches the build process of the plugin, as v4.0.0 did not release on the plugin catalog.
4+
There is no difference from v4.0.0 for Docker users.
5+
16
## 4.0.0 (2025-07-22)
27

38
- Build: Update all dependencies, [#663](https://github.com/grafana/grafana-image-renderer/pull/663), [Proximyst](https://github.com/Proximyst)

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"url": "https://github.com/grafana/grafana-image-renderer/blob/master/LICENSE"
2525
}
2626
],
27-
"version": "4.0.0",
27+
"version": "4.0.1",
2828
"updated": "2025-07-22"
2929
},
3030
"dependencies": {

0 commit comments

Comments
 (0)