refactor: rename workflow and improve version bumping process
This commit is contained in:
@@ -1,37 +1,43 @@
|
|||||||
name: Sync Plugin Version
|
name: Bump Version
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sync-version:
|
bump-version:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Extract version from version.py
|
- name: Bump patch version
|
||||||
id: version
|
|
||||||
run: |
|
run: |
|
||||||
VERSION=$(python3 -c "exec(open('mempalace/version.py').read()); print(__version__)")
|
CURRENT=$(python3 -c "exec(open('mempalace/version.py').read()); print(__version__)")
|
||||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
|
||||||
|
PATCH=$((PATCH + 1))
|
||||||
|
NEW="${MAJOR}.${MINOR}.${PATCH}"
|
||||||
|
echo "__version__ = \"${NEW}\"" > mempalace/version.py
|
||||||
|
# Prepend docstring
|
||||||
|
sed -i '1i"""Single source of truth for the MemPalace package version."""\n' mempalace/version.py
|
||||||
|
echo "version=$NEW" >> "$GITHUB_OUTPUT"
|
||||||
|
id: version
|
||||||
|
|
||||||
- name: Update plugin.json
|
- name: Sync plugin.json
|
||||||
run: |
|
run: |
|
||||||
jq --arg v "${{ steps.version.outputs.version }}" '.version = $v' .claude-plugin/plugin.json > tmp.json && mv tmp.json .claude-plugin/plugin.json
|
jq --arg v "${{ steps.version.outputs.version }}" '.version = $v' .claude-plugin/plugin.json > tmp.json && mv tmp.json .claude-plugin/plugin.json
|
||||||
|
|
||||||
- name: Update marketplace.json
|
- name: Sync marketplace.json
|
||||||
run: |
|
run: |
|
||||||
jq --arg v "${{ steps.version.outputs.version }}" '.plugins[0].version = $v' .claude-plugin/marketplace.json > tmp.json && mv tmp.json .claude-plugin/marketplace.json
|
jq --arg v "${{ steps.version.outputs.version }}" '.plugins[0].version = $v' .claude-plugin/marketplace.json > tmp.json && mv tmp.json .claude-plugin/marketplace.json
|
||||||
|
|
||||||
- name: Commit if changed
|
- name: Commit and push
|
||||||
run: |
|
run: |
|
||||||
git config user.name "github-actions[bot]"
|
git config user.name "github-actions[bot]"
|
||||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git add .claude-plugin/plugin.json .claude-plugin/marketplace.json
|
git add mempalace/version.py .claude-plugin/plugin.json .claude-plugin/marketplace.json
|
||||||
if ! git diff --staged --quiet; then
|
if ! git diff --staged --quiet; then
|
||||||
git commit -m "chore: sync plugin version to ${{ steps.version.outputs.version }}"
|
git commit -m "chore: bump version to ${{ steps.version.outputs.version }}"
|
||||||
git push
|
git push
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user