Skip to content

✨ feat: 添加 Agent Temple 组件模块 #5

✨ feat: 添加 Agent Temple 组件模块

✨ feat: 添加 Agent Temple 组件模块 #5

Workflow file for this run

name: Auto Release
on:
push:
branches:
- main
paths:
- 'package.json'
jobs:
check-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
tag_exists: ${{ steps.check_tag.outputs.exists }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Get version from package.json
id: version
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=v$VERSION" >> $GITHUB_OUTPUT
echo "Version: v$VERSION"
- name: Check if version changed
id: version_changed
run: |
git diff HEAD^ HEAD -- package.json | grep '"version"' && echo "changed=true" >> $GITHUB_OUTPUT || echo "changed=false" >> $GITHUB_OUTPUT
- name: Check if tag exists
id: check_tag
run: |
VERSION=$(node -p "require('./package.json').version")
if git ls-remote --tags origin | grep -q "refs/tags/v$VERSION"; then
echo "exists=true" >> $GITHUB_OUTPUT
echo "Tag v$VERSION already exists"
else
echo "exists=false" >> $GITHUB_OUTPUT
echo "Tag v$VERSION does not exist"
fi
create-release:
needs: check-version
if: needs.check-version.outputs.tag_exists == 'false'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Get version info
id: version_info
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Create and push tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -a "v${{ steps.version_info.outputs.version }}" -m "Release v${{ steps.version_info.outputs.version }}"
git push origin "v${{ steps.version_info.outputs.version }}"