|
1 | | -name: Release |
2 | | - |
3 | | -on: |
4 | | - push: |
5 | | - branches: [main] |
6 | | - workflow_dispatch: |
7 | | - |
8 | | -jobs: |
9 | | - check-version: |
10 | | - runs-on: ubuntu-latest |
11 | | - outputs: |
12 | | - should_release: ${{ steps.check.outputs.should_release }} |
13 | | - version: ${{ steps.extract.outputs.version }} |
14 | | - steps: |
15 | | - - uses: actions/checkout@v4 |
16 | | - with: |
17 | | - fetch-depth: 0 |
18 | | - |
19 | | - - name: Extract version from pyproject.toml |
20 | | - id: extract |
21 | | - run: | |
22 | | - VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/') |
23 | | - echo "version=$VERSION" >> $GITHUB_OUTPUT |
24 | | - echo "Version: $VERSION" |
25 | | -
|
26 | | - - name: Check if tag exists |
27 | | - id: check |
28 | | - run: | |
29 | | - VERSION="${{ steps.extract.outputs.version }}" |
30 | | - if git rev-parse "v$VERSION" >/dev/null 2>&1; then |
31 | | - echo "Tag v$VERSION already exists" |
32 | | - echo "should_release=false" >> $GITHUB_OUTPUT |
33 | | - else |
34 | | - echo "Tag v$VERSION does not exist" |
35 | | - echo "should_release=true" >> $GITHUB_OUTPUT |
36 | | - fi |
37 | | -
|
38 | | - release: |
39 | | - needs: check-version |
40 | | - if: needs.check-version.outputs.should_release == 'true' |
41 | | - runs-on: ubuntu-latest |
42 | | - permissions: |
43 | | - contents: write |
44 | | - id-token: write # For trusted PyPI publishing |
45 | | - steps: |
46 | | - - uses: actions/checkout@v4 |
47 | | - with: |
48 | | - fetch-depth: 0 |
49 | | - |
50 | | - - name: Install uv |
51 | | - uses: astral-sh/setup-uv@v4 |
52 | | - with: |
53 | | - version: "latest" |
54 | | - |
55 | | - - name: Set up Python |
56 | | - run: uv python install |
57 | | - |
58 | | - - name: Extract changelog for version |
59 | | - id: changelog |
60 | | - run: | |
61 | | - VERSION="${{ needs.check-version.outputs.version }}" |
62 | | - echo "Extracting changelog for version $VERSION" |
63 | | -
|
64 | | - # Extract the changelog section for this version using sed |
65 | | - sed -n "/^## \\[$VERSION\\]/,/^## \\[/{/^## \\[$VERSION\\]/d; /^## \\[/q; /^$/d; p}" CHANGELOG.md > release_notes.md |
66 | | -
|
67 | | - # If no changelog found, create a simple message |
68 | | - if [ ! -s release_notes.md ]; then |
69 | | - echo "No specific changelog found for version $VERSION" > release_notes.md |
70 | | - fi |
71 | | -
|
72 | | - echo "Release notes:" |
73 | | - cat release_notes.md |
74 | | -
|
75 | | - - name: Create git tag |
76 | | - run: | |
77 | | - VERSION="${{ needs.check-version.outputs.version }}" |
78 | | - git config user.name "GitHub Actions" |
79 | | - git config user.email "actions@github.com" |
80 | | - git tag -a "v$VERSION" -m "Release v$VERSION" |
81 | | - git push origin "v$VERSION" |
82 | | -
|
83 | | - - name: Create GitHub Release |
84 | | - uses: softprops/action-gh-release@v2 |
85 | | - with: |
86 | | - tag_name: v${{ needs.check-version.outputs.version }} |
87 | | - name: Release v${{ needs.check-version.outputs.version }} |
88 | | - body_path: release_notes.md |
89 | | - draft: false |
90 | | - prerelease: false |
91 | | - |
92 | | - - name: Build package |
93 | | - run: | |
94 | | - uv build |
95 | | - ls -la dist/ |
96 | | -
|
97 | | - - name: Publish to PyPI |
98 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
99 | | - with: |
100 | | - skip-existing: true |
101 | | - |
102 | | - notify-success: |
103 | | - needs: [check-version, release] |
104 | | - if: needs.check-version.outputs.should_release == 'true' && success() |
105 | | - runs-on: ubuntu-latest |
106 | | - steps: |
107 | | - - name: Success notification |
108 | | - run: | |
109 | | - echo "🎉 Successfully released v${{ needs.check-version.outputs.version }}!" |
110 | | - echo "- GitHub Release: https://github.com/${{ github.repository }}/releases/tag/v${{ needs.check-version.outputs.version }}" |
111 | | - echo "- PyPI: https://pypi.org/project/claude-monitor/${{ needs.check-version.outputs.version }}/" |
| 1 | +# name: Release |
| 2 | + |
| 3 | +# on: |
| 4 | +# push: |
| 5 | +# branches: [main] |
| 6 | +# workflow_dispatch: |
| 7 | + |
| 8 | +# jobs: |
| 9 | +# check-version: |
| 10 | +# runs-on: ubuntu-latest |
| 11 | +# outputs: |
| 12 | +# should_release: ${{ steps.check.outputs.should_release }} |
| 13 | +# version: ${{ steps.extract.outputs.version }} |
| 14 | +# steps: |
| 15 | +# - uses: actions/checkout@v4 |
| 16 | +# with: |
| 17 | +# fetch-depth: 0 |
| 18 | + |
| 19 | +# - name: Extract version from pyproject.toml |
| 20 | +# id: extract |
| 21 | +# run: | |
| 22 | +# VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/') |
| 23 | +# echo "version=$VERSION" >> $GITHUB_OUTPUT |
| 24 | +# echo "Version: $VERSION" |
| 25 | + |
| 26 | +# - name: Check if tag exists |
| 27 | +# id: check |
| 28 | +# run: | |
| 29 | +# VERSION="${{ steps.extract.outputs.version }}" |
| 30 | +# if git rev-parse "v$VERSION" >/dev/null 2>&1; then |
| 31 | +# echo "Tag v$VERSION already exists" |
| 32 | +# echo "should_release=false" >> $GITHUB_OUTPUT |
| 33 | +# else |
| 34 | +# echo "Tag v$VERSION does not exist" |
| 35 | +# echo "should_release=true" >> $GITHUB_OUTPUT |
| 36 | +# fi |
| 37 | + |
| 38 | +# release: |
| 39 | +# needs: check-version |
| 40 | +# if: needs.check-version.outputs.should_release == 'true' |
| 41 | +# runs-on: ubuntu-latest |
| 42 | +# permissions: |
| 43 | +# contents: write |
| 44 | +# id-token: write # For trusted PyPI publishing |
| 45 | +# steps: |
| 46 | +# - uses: actions/checkout@v4 |
| 47 | +# with: |
| 48 | +# fetch-depth: 0 |
| 49 | + |
| 50 | +# - name: Install uv |
| 51 | +# uses: astral-sh/setup-uv@v4 |
| 52 | +# with: |
| 53 | +# version: "latest" |
| 54 | + |
| 55 | +# - name: Set up Python |
| 56 | +# run: uv python install |
| 57 | + |
| 58 | +# - name: Extract changelog for version |
| 59 | +# id: changelog |
| 60 | +# run: | |
| 61 | +# VERSION="${{ needs.check-version.outputs.version }}" |
| 62 | +# echo "Extracting changelog for version $VERSION" |
| 63 | + |
| 64 | +# # Extract the changelog section for this version using sed |
| 65 | +# sed -n "/^## \\[$VERSION\\]/,/^## \\[/{/^## \\[$VERSION\\]/d; /^## \\[/q; /^$/d; p}" CHANGELOG.md > release_notes.md |
| 66 | + |
| 67 | +# # If no changelog found, create a simple message |
| 68 | +# if [ ! -s release_notes.md ]; then |
| 69 | +# echo "No specific changelog found for version $VERSION" > release_notes.md |
| 70 | +# fi |
| 71 | + |
| 72 | +# echo "Release notes:" |
| 73 | +# cat release_notes.md |
| 74 | + |
| 75 | +# - name: Create git tag |
| 76 | +# run: | |
| 77 | +# VERSION="${{ needs.check-version.outputs.version }}" |
| 78 | +# git config user.name "GitHub Actions" |
| 79 | +# git config user.email "actions@github.com" |
| 80 | +# git tag -a "v$VERSION" -m "Release v$VERSION" |
| 81 | +# git push origin "v$VERSION" |
| 82 | + |
| 83 | +# - name: Create GitHub Release |
| 84 | +# uses: softprops/action-gh-release@v2 |
| 85 | +# with: |
| 86 | +# tag_name: v${{ needs.check-version.outputs.version }} |
| 87 | +# name: Release v${{ needs.check-version.outputs.version }} |
| 88 | +# body_path: release_notes.md |
| 89 | +# draft: false |
| 90 | +# prerelease: false |
| 91 | + |
| 92 | +# - name: Build package |
| 93 | +# run: | |
| 94 | +# uv build |
| 95 | +# ls -la dist/ |
| 96 | + |
| 97 | +# - name: Publish to PyPI |
| 98 | +# uses: pypa/gh-action-pypi-publish@release/v1 |
| 99 | +# with: |
| 100 | +# skip-existing: true |
| 101 | + |
| 102 | +# notify-success: |
| 103 | +# needs: [check-version, release] |
| 104 | +# if: needs.check-version.outputs.should_release == 'true' && success() |
| 105 | +# runs-on: ubuntu-latest |
| 106 | +# steps: |
| 107 | +# - name: Success notification |
| 108 | +# run: | |
| 109 | +# echo "🎉 Successfully released v${{ needs.check-version.outputs.version }}!" |
| 110 | +# echo "- GitHub Release: https://github.com/${{ github.repository }}/releases/tag/v${{ needs.check-version.outputs.version }}" |
| 111 | +# echo "- PyPI: https://pypi.org/project/claude-monitor/${{ needs.check-version.outputs.version }}/" |
0 commit comments