Skip to content

Commit 5c5a685

Browse files
Auto update the latest build link (#5)
* Add CI to update the latest build URL * Update link to latest build * Add new step job update-latest-artifact-link to CI * Update link to latest build * add link to download section * change to condition of artifact link branch to master * update commit message --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 82ff8c5 commit 5c5a685

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

.github/workflows/ci.yml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,17 @@ on:
44
push:
55
branches:
66
- '*'
7+
paths-ignore:
8+
- README.md
79
pull_request:
810
branches:
911
- master
1012
- main
13+
paths-ignore:
14+
- README.md
1115

12-
permissions: read-all
16+
permissions:
17+
contents: write
1318

1419
jobs:
1520
build:
@@ -20,6 +25,7 @@ jobs:
2025
plugin-version: ${{ steps.metadata.outputs.plugin-version }}
2126
has-e2e: ${{ steps.check-for-e2e.outputs.has-e2e }}
2227
has-backend: ${{ steps.check-for-backend.outputs.has-backend }}
28+
artifact-url: ${{ steps.archive-build.outputs.artifact-url }}
2329
env:
2430
GRAFANA_ACCESS_POLICY_TOKEN: ${{ secrets.GRAFANA_ACCESS_POLICY_TOKEN }}
2531
steps:
@@ -103,6 +109,7 @@ jobs:
103109
104110
- name: Archive Build
105111
uses: actions/upload-artifact@v4
112+
id: archive-build
106113
with:
107114
name: ${{ steps.metadata.outputs.plugin-id }}-${{ steps.metadata.outputs.plugin-version }}
108115
path: ${{ steps.metadata.outputs.plugin-id }}
@@ -200,3 +207,19 @@ jobs:
200207
# name: playwright-report-${{ matrix.GRAFANA_IMAGE.NAME }}-v${{ matrix.GRAFANA_IMAGE.VERSION }}-${{github.run_id}}
201208
# path: playwright-report/
202209
# retention-days: 5
210+
211+
update-latest-artifact-link:
212+
needs: [playwright-tests, build]
213+
runs-on: ubuntu-latest
214+
name: Update link to the latest artifact
215+
steps:
216+
- name: Checkout
217+
uses: actions/checkout@v4
218+
- name: Update the latest workflow artifact URL
219+
if: github.ref == 'refs/heads/master'
220+
run: |
221+
sed -i 's|\[Download the latest build\](.*)|\[Download the latest build\](${{ needs.build.outputs.artifact-url }})|' README.md
222+
git config --global user.name 'github-actions[bot]'
223+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
224+
git commit -am "Update link to the latest workflow artifact"
225+
git push

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ This plugin provides a Grafana datasource for querying and visualizing data from
55

66
![screenshot](/static/screenshot.png)
77

8+
## Download
9+
[Download the latest build](https://github.com/haohanyang/mongodb-datasource/actions/runs/11218336228/artifacts/2024560027)
10+
11+
812
## Use
913
### Query language
1014
The query text should be a valid MongoDB Aggregate pipeline - an array consisting of MongoDB Aggregate operations. Your may use the Grafana's built-in variables `"$__from"` and `"$__to"` to query data based on the current panel's time range. The plugin supports JSON and JavaScript query languages. In JSON query, you need to enter the database in the UI. Here is an example of JSON query.
@@ -120,7 +124,7 @@ Table type is more flexible and doesn't require the output schema. This usually
120124

121125

122126
## Install
123-
* Download the artifact package plugin `haohanyang-mongodb-datasource-<version>.zip` from [GitHub Action](https://github.com/haohanyang/mongodb-datasource/actions/workflows/ci.yml?query=branch%3Amaster) page to the root directory (where the `docker-compose.yaml` exists) and extract files to folder `mongodb-datasource`
127+
* Download the packaged plugin `haohanyang-mongodb-datasource-<version>.zip` from [workflow artifacts](#download) to the root directory (where `docker-compose.yaml` exists) and extract files to folder `mongodb-datasource`
124128

125129
```bash
126130
unzip haohanyang-mongodb-datasource-<version>.zip -d mongodb-datasource

0 commit comments

Comments
 (0)