feat: auto-sync repo About section from registry.json on release #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - "*.md" | |
| - "docs/**" | |
| - "standards/**" | |
| - "LICENSE" | |
| - ".github/release-drafter.yml" | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: release | |
| cancel-in-progress: false | |
| jobs: | |
| release: | |
| name: Create release | |
| runs-on: ubuntu-latest | |
| if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get latest tag | |
| id: tag | |
| run: | | |
| TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") | |
| echo "current=$TAG" >> "$GITHUB_OUTPUT" | |
| - name: Determine version bump | |
| id: bump | |
| run: | | |
| CURRENT="${{ steps.tag.outputs.current }}" | |
| CURRENT="${CURRENT#v}" | |
| IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT" | |
| COMMITS=$(git log "${{ steps.tag.outputs.current }}..HEAD" --pretty=format:"%s" 2>/dev/null || git log --pretty=format:"%s") | |
| if echo "$COMMITS" | grep -qE "^feat!:|BREAKING CHANGE"; then | |
| MAJOR=$((MAJOR + 1)) | |
| MINOR=0 | |
| PATCH=0 | |
| elif echo "$COMMITS" | grep -qE "^feat(\(.*\))?:"; then | |
| MINOR=$((MINOR + 1)) | |
| PATCH=0 | |
| else | |
| PATCH=$((PATCH + 1)) | |
| fi | |
| NEW="$MAJOR.$MINOR.$PATCH" | |
| echo "version=$NEW" >> "$GITHUB_OUTPUT" | |
| echo "tag=v$NEW" >> "$GITHUB_OUTPUT" | |
| - name: Create tag | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag -a "${{ steps.bump.outputs.tag }}" -m "Release ${{ steps.bump.outputs.tag }}" | |
| git push origin "${{ steps.bump.outputs.tag }}" | |
| - name: Create GitHub Release | |
| run: | | |
| gh release create "${{ steps.bump.outputs.tag }}" \ | |
| --title "${{ steps.bump.outputs.tag }}" \ | |
| --generate-notes | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Sync repo About section | |
| run: | | |
| TOOLS=$(python3 -c "import json; data=json.load(open('registry.json')); print(len(data))") | |
| SKILLS=$(python3 -c "import json; data=json.load(open('registry.json')); print(sum(t.get('skills',0) for t in data))") | |
| RULES=$(python3 -c "import json; data=json.load(open('registry.json')); print(sum(t.get('rules',0) for t in data))") | |
| MCP=$(python3 -c "import json; data=json.load(open('registry.json')); print(sum(t.get('mcpTools',0) for t in data))") | |
| DESC="Centralized catalog, standards, and scaffolding for ${TOOLS} TMHSDigital developer tools - ${SKILLS} skills, ${RULES} rules, ${MCP} MCP tools" | |
| gh repo edit "${{ github.repository }}" \ | |
| --description "$DESC" \ | |
| --homepage "https://tmhsdigital.github.io/Developer-Tools-Directory/" | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |