Skip to content

Commit ac59cca

Browse files
committed
fix(ci): merge tag+release into single workflow, override GITHUB_REF for build-plugin
1 parent e73fb08 commit ac59cca

3 files changed

Lines changed: 28 additions & 34 deletions

File tree

.github/workflows/release.yml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ name: Release
22

33
on:
44
push:
5-
tags:
6-
- 'v*'
5+
branches:
6+
- main
7+
paths:
8+
- 'package.json'
79

810
permissions:
911
contents: write
@@ -15,14 +17,34 @@ jobs:
1517
GOTOOLCHAIN: auto
1618
steps:
1719
- uses: actions/checkout@v6
18-
19-
- uses: actions/setup-go@v5
2020
with:
21-
go-version: '1.25'
21+
fetch-depth: 2
22+
23+
- name: Check version change
24+
id: check
25+
run: |
26+
CURRENT=$(jq -r .version package.json)
27+
PREVIOUS=$(git show HEAD~1:package.json 2>/dev/null | jq -r .version 2>/dev/null || echo "")
28+
if [ "$CURRENT" != "$PREVIOUS" ] && [ -n "$CURRENT" ]; then
29+
echo "version=${CURRENT}" >> "$GITHUB_OUTPUT"
30+
echo "changed=true" >> "$GITHUB_OUTPUT"
31+
else
32+
echo "changed=false" >> "$GITHUB_OUTPUT"
33+
fi
34+
35+
- name: Create tag
36+
if: steps.check.outputs.changed == 'true'
37+
run: |
38+
git tag "v${{ steps.check.outputs.version }}"
39+
git push origin "v${{ steps.check.outputs.version }}"
2240
2341
- uses: pnpm/action-setup@v4
42+
if: steps.check.outputs.changed == 'true'
2443

2544
- uses: grafana/plugin-actions/build-plugin@release
45+
if: steps.check.outputs.changed == 'true'
46+
env:
47+
GITHUB_REF: refs/tags/v${{ steps.check.outputs.version }}
2648
with:
2749
go-version: '1.25'
2850
node-version: '24'

.github/workflows/tag.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "datasource-databend",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "Grafana datasource plugin for Databend",
55
"scripts": {
66
"build": "webpack -c ./.config/webpack/webpack.config.ts --env production",

0 commit comments

Comments
 (0)