Skip to content

Commit

Permalink
ci: Do nightly releases only on main
Browse files Browse the repository at this point in the history
* Able to choose nightly release using env var for boostrap script

* Update README

Signed-off-by: Mahendra Paipuri <mahendra.paipuri@gmail.com>
  • Loading branch information
mahendrapaipuri committed Feb 2, 2024
1 parent 8ec2272 commit 74e9290
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ jobs:

- name: Release nightly
uses: softprops/action-gh-release@v1
# Only run on main branch
if: github.ref == 'refs/heads/main'
with:
prerelease: true
name: nightly
Expand Down
13 changes: 6 additions & 7 deletions scripts/bootstrap-dashboard-reporter-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ if [[ $ALL_RELEASES == *"Not Found"* ]]; then
fi

# Extract the latest pre-release tag from the release information
LATEST_RELEASE_TAG=$(echo "$ALL_RELEASES" | grep -Eo '"tag_name": "[^"]*' | sed -E 's/"tag_name": "//' | head -n 1)
VERSION=$(echo "$LATEST_RELEASE_TAG" | sed 's/^v//')
if [[ -z "$LATEST_RELEASE_TAG" ]]; then
echo "No pre-release found for the $REPO_NAME repository."
exit 1
if [[ -z "$NIGHTLY" ]]; then
LATEST_RELEASE_TAG=$(echo "$ALL_RELEASES" | grep -Eo '"tag_name": "v[^"]*' | sed -E 's/"tag_name": "//' | head -n 1)
echo "The latest release tag of $REPO_NAME is: $LATEST_RELEASE_TAG"
else
echo "Using latest nightly release"
LATEST_RELEASE_TAG="nightly"
fi

echo "The latest release tag of $REPO_NAME is: $LATEST_RELEASE_TAG"

curl -L https://github.com/mahendrapaipuri/grafana-dashboard-reporter-app/releases/download/$LATEST_RELEASE_TAG/mahendrapaipuri-dashboardreporter-app.zip --output mahendrapaipuri-dashboardreporter-app.zip
unzip mahendrapaipuri-dashboardreporter-app.zip -d .
14 changes: 11 additions & 3 deletions src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,19 @@ plugin directory:

```
cd /var/lib/grafana/plugins
curl https://raw.githubusercontent.com/mahendrapaipuri/grafana-dashboard-reporter-app/grafana_labs_review/scripts/bootstrap-dashboard-reporter-app.sh | bash
curl https://raw.githubusercontent.com/mahendrapaipuri/grafana-dashboard-reporter-app/main/scripts/bootstrap-dashboard-reporter-app.sh | bash
```

This will install the plugin in the `/var/lib/grafana/plugins` folder and upon Grafana
restart, the plugin will be loaded.
This will install the latest release of plugin in the `/var/lib/grafana/plugins` folder
and upon Grafana restart, the plugin will be loaded.

If user wants to install the latest nightly release, it is enough to add a environment
variable `NIGHTLY` to `bash`

```
cd /var/lib/grafana/plugins
curl https://raw.githubusercontent.com/mahendrapaipuri/grafana-dashboard-reporter-app/main/scripts/bootstrap-dashboard-reporter-app.sh | NIGHTLY=1 bash
```

The current example assumes the following configuration is set for Grafana

Expand Down

0 comments on commit 74e9290

Please sign in to comment.