Skip to content

Commit 2f4a593

Browse files
committed
feat(v1.2.0): README badge fix, add label-sync.yml and release.yml
Made-with: Cursor
1 parent 29339d0 commit 2f4a593

File tree

3 files changed

+184
-1
lines changed

3 files changed

+184
-1
lines changed

.github/workflows/label-sync.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Label PRs
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
7+
permissions:
8+
contents: read
9+
pull-requests: write
10+
11+
jobs:
12+
label:
13+
name: Auto-label by path
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Get changed files
19+
id: changed
20+
run: |
21+
FILES=$(gh pr diff ${{ github.event.pull_request.number }} --name-only)
22+
echo "files<<EOF" >> "$GITHUB_OUTPUT"
23+
echo "$FILES" >> "$GITHUB_OUTPUT"
24+
echo "EOF" >> "$GITHUB_OUTPUT"
25+
env:
26+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
28+
- name: Apply labels
29+
run: |
30+
LABELS=""
31+
32+
if echo "$FILES" | grep -q "^skills/"; then
33+
LABELS="$LABELS,skills"
34+
fi
35+
36+
if echo "$FILES" | grep -q "^rules/"; then
37+
LABELS="$LABELS,rules"
38+
fi
39+
40+
if echo "$FILES" | grep -q "^mcp-server/"; then
41+
LABELS="$LABELS,mcp-server"
42+
fi
43+
44+
if echo "$FILES" | grep -q "^docs/"; then
45+
LABELS="$LABELS,documentation"
46+
fi
47+
48+
if echo "$FILES" | grep -q "^\.github/"; then
49+
LABELS="$LABELS,ci"
50+
fi
51+
52+
LABELS="${LABELS#,}"
53+
54+
if [ -n "$LABELS" ]; then
55+
gh pr edit ${{ github.event.pull_request.number }} --add-label "$LABELS"
56+
fi
57+
env:
58+
FILES: ${{ steps.changed.outputs.files }}
59+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths-ignore:
7+
- ".github/**"
8+
- "docs/**"
9+
- "*.md"
10+
- "LICENSE"
11+
12+
permissions:
13+
contents: write
14+
15+
concurrency:
16+
group: release
17+
cancel-in-progress: false
18+
19+
jobs:
20+
version-and-release:
21+
name: Bump version, tag, and release
22+
runs-on: ubuntu-latest
23+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Get current version
30+
id: current
31+
run: |
32+
version=$(python3 -c "import json; print(json.load(open('.cursor-plugin/plugin.json'))['version'])")
33+
echo "version=$version" >> "$GITHUB_OUTPUT"
34+
35+
- name: Determine bump type from commits
36+
id: bump
37+
run: |
38+
last_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
39+
if [ -z "$last_tag" ]; then
40+
commits=$(git log --oneline --format="%s")
41+
else
42+
commits=$(git log "$last_tag"..HEAD --oneline --format="%s")
43+
fi
44+
45+
bump="patch"
46+
if echo "$commits" | grep -qiE "^(feat|feature)(\(.+\))?!:|BREAKING CHANGE"; then
47+
bump="major"
48+
elif echo "$commits" | grep -qiE "^(feat|feature)(\(.+\))?:"; then
49+
bump="minor"
50+
fi
51+
52+
echo "bump=$bump" >> "$GITHUB_OUTPUT"
53+
54+
- name: Compute new version
55+
id: new
56+
run: |
57+
current="${{ steps.current.outputs.version }}"
58+
bump="${{ steps.bump.outputs.bump }}"
59+
IFS='.' read -r major minor patch <<< "$current"
60+
case "$bump" in
61+
major) major=$((major + 1)); minor=0; patch=0 ;;
62+
minor) minor=$((minor + 1)); patch=0 ;;
63+
patch) patch=$((patch + 1)) ;;
64+
esac
65+
echo "version=$major.$minor.$patch" >> "$GITHUB_OUTPUT"
66+
67+
- name: Check if version changed
68+
id: check
69+
run: |
70+
if [ "${{ steps.current.outputs.version }}" = "${{ steps.new.outputs.version }}" ]; then
71+
echo "skip=true" >> "$GITHUB_OUTPUT"
72+
else
73+
echo "skip=false" >> "$GITHUB_OUTPUT"
74+
fi
75+
76+
- name: Update version files
77+
if: steps.check.outputs.skip == 'false'
78+
env:
79+
NEW_VERSION: ${{ steps.new.outputs.version }}
80+
OLD_VERSION: ${{ steps.current.outputs.version }}
81+
run: |
82+
python3 -c "
83+
import json, os
84+
85+
new_version = os.environ['NEW_VERSION']
86+
old_version = os.environ['OLD_VERSION']
87+
88+
path = '.cursor-plugin/plugin.json'
89+
with open(path) as f:
90+
data = json.load(f)
91+
data['version'] = new_version
92+
with open(path, 'w') as f:
93+
json.dump(data, f, indent=2)
94+
f.write('\n')
95+
96+
readme = 'README.md'
97+
with open(readme) as f:
98+
content = f.read()
99+
content = content.replace(
100+
f'version-{old_version}-',
101+
f'version-{new_version}-'
102+
)
103+
with open(readme, 'w') as f:
104+
f.write(content)
105+
"
106+
107+
- name: Commit and tag
108+
if: steps.check.outputs.skip == 'false'
109+
run: |
110+
git config user.name "github-actions[bot]"
111+
git config user.email "github-actions[bot]@users.noreply.github.com"
112+
git add -A
113+
git commit -m "chore: bump version to ${{ steps.new.outputs.version }} [skip ci]"
114+
git tag "v${{ steps.new.outputs.version }}"
115+
git push origin main --tags
116+
117+
- name: Create GitHub Release
118+
if: steps.check.outputs.skip == 'false'
119+
env:
120+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
run: |
122+
gh release create "v${{ steps.new.outputs.version }}" \
123+
--title "v${{ steps.new.outputs.version }}" \
124+
--generate-notes

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</p>
1010

1111
<p align="center">
12-
<img src="https://img.shields.io/badge/version-1.0.0-0db7ed?style=flat-square" alt="Version" />
12+
<a href="https://github.com/TMHSDigital/Docker-Developer-Tools/releases/latest"><img src="https://img.shields.io/badge/version-1.0.0-0db7ed?style=flat-square" alt="Version" /></a>
1313
<a href="https://github.com/TMHSDigital/Docker-Developer-Tools/releases/latest"><img src="https://img.shields.io/github/v/release/TMHSDigital/Docker-Developer-Tools?style=flat-square&color=0db7ed&label=release" alt="Release" /></a>
1414
<a href="https://www.npmjs.com/package/@tmhs/docker-mcp"><img src="https://img.shields.io/npm/v/@tmhs/docker-mcp?style=flat-square&color=066da5&label=npm" alt="npm" /></a>
1515
<a href="LICENSE"><img src="https://img.shields.io/badge/license-CC--BY--NC--ND--4.0-384d54?style=flat-square" alt="License" /></a>

0 commit comments

Comments
 (0)