-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (44 loc) · 1.62 KB
/
release.yml
File metadata and controls
54 lines (44 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Release
on:
push:
branches: [main]
jobs:
tag:
name: Tag released plugins
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # need all tags to detect existing releases
- name: Detect version changes and tag
env:
SIGN_TAGS: ${{ secrets.UNIC_SIGN_TAGS }}
run: |
tag_if_changed() {
local plugin_dir="$1"
local json_path="$plugin_dir/.claude-plugin/plugin.json"
if [ ! -f "$json_path" ]; then return; fi
current=$(node -p "JSON.parse(require('fs').readFileSync('$json_path','utf8')).version")
name=$(node -p "JSON.parse(require('fs').readFileSync('$json_path','utf8')).name")
if [ -z "$current" ] || [ "$current" = "undefined" ] || [ -z "$name" ] || [ "$name" = "undefined" ]; then
echo "Invalid plugin metadata in $json_path: name='$name', version='$current'"
exit 1
fi
tag="${name}@${current}"
if git rev-parse --verify "refs/tags/$tag" >/dev/null 2>&1; then
echo "Tag $tag already exists, skipping"
return
fi
echo "Tagging $tag"
if [ "$SIGN_TAGS" = "true" ]; then
git tag -s "$tag" -m "Release $tag"
else
git tag "$tag"
fi
git push origin "$tag"
}
tag_if_changed "apps/claude-code/pr-review"
tag_if_changed "apps/claude-code/auto-format"
tag_if_changed "apps/claude-code/unic-confluence"