|
1 | | ---- |
| 1 | +# --- |
| 2 | +# name: Automated Version Bump and Changelog |
| 3 | +# on: |
| 4 | +# push: |
| 5 | +# branches: [main] |
| 6 | +# paths-ignore: [README.md, docs/**, .github/**] |
| 7 | +# permissions: |
| 8 | +# contents: write # ✅ allow tag pushes and commits |
| 9 | +# jobs: |
| 10 | +# bump-version: |
| 11 | +# runs-on: ubuntu-latest |
| 12 | +# steps: |
| 13 | +# - name: Checkout repo |
| 14 | +# uses: actions/checkout@v4 |
| 15 | +# with: |
| 16 | +# fetch-depth: 0 # Needed for tags and full history |
| 17 | +# - name: Set up Python |
| 18 | +# uses: actions/setup-python@v5 |
| 19 | +# with: |
| 20 | +# python-version: '3.13' |
| 21 | +# - name: Install tools |
| 22 | +# run: | |
| 23 | +# pip install bump-my-version |
| 24 | +# sudo apt-get update |
| 25 | +# sudo apt-get install -y git |
| 26 | +# - name: Configure Git |
| 27 | +# run: | |
| 28 | +# git config user.name "github-actions[bot]" |
| 29 | +# git config user.email "github-actions[bot]@users.noreply.github.com" |
| 30 | +# git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git |
| 31 | +# - name: Ensure initial tag exists |
| 32 | +# run: | |
| 33 | +# if ! git describe --tags --abbrev=0 >/dev/null 2>&1; then |
| 34 | +# git tag v0.0.0 |
| 35 | +# git push --tags |
| 36 | +# fi |
| 37 | +# - name: Get latest tag |
| 38 | +# id: latest_tag |
| 39 | +# run: | |
| 40 | +# echo "tag=$(git describe --tags --abbrev=0 || echo 'v0.0.0')" >> $GITHUB_OUTPUT |
| 41 | +# - name: Generate changelog |
| 42 | +# run: | |
| 43 | +# echo "## Changelog" > CHANGELOG.md |
| 44 | +# echo "" >> CHANGELOG.md |
| 45 | +# git log ${{ steps.latest_tag.outputs.tag }}..HEAD --pretty=format:"- %s (%an)" >> CHANGELOG.md |
| 46 | +# - name: Bump patch version |
| 47 | +# run: |- |
| 48 | +# bump-my-version bump patch --verbose |
| 49 | +# git add CHANGELOG.md |
| 50 | +# git commit -m "bump: patch version + changelog [skip ci]" || echo "No changes to commit" |
| 51 | +# git push |
| 52 | +# git push --tags |
2 | 53 | name: Automated Version Bump and Changelog |
| 54 | + |
3 | 55 | on: |
4 | 56 | push: |
5 | 57 | branches: [main] |
6 | 58 | paths-ignore: [README.md, docs/**, .github/**] |
| 59 | + |
7 | 60 | permissions: |
8 | | - contents: write # ✅ allow tag pushes and commits |
| 61 | + contents: write |
| 62 | + |
9 | 63 | jobs: |
10 | 64 | bump-version: |
11 | 65 | runs-on: ubuntu-latest |
12 | 66 | steps: |
13 | 67 | - name: Checkout repo |
14 | 68 | uses: actions/checkout@v4 |
15 | 69 | with: |
16 | | - fetch-depth: 0 # Needed for tags and full history |
| 70 | + fetch-depth: 0 |
| 71 | + |
17 | 72 | - name: Set up Python |
18 | 73 | uses: actions/setup-python@v5 |
19 | 74 | with: |
20 | 75 | python-version: '3.13' |
21 | | - - name: Install tools |
| 76 | + |
| 77 | + - name: Install bump-my-version |
22 | 78 | run: | |
23 | 79 | pip install bump-my-version |
24 | | - sudo apt-get update |
25 | | - sudo apt-get install -y git |
| 80 | +
|
26 | 81 | - name: Configure Git |
27 | 82 | run: | |
28 | 83 | git config user.name "github-actions[bot]" |
29 | 84 | git config user.email "github-actions[bot]@users.noreply.github.com" |
30 | 85 | git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git |
| 86 | +
|
31 | 87 | - name: Ensure initial tag exists |
32 | 88 | run: | |
33 | 89 | if ! git describe --tags --abbrev=0 >/dev/null 2>&1; then |
34 | 90 | git tag v0.0.0 |
35 | 91 | git push --tags |
36 | 92 | fi |
37 | | - - name: Get latest tag |
38 | | - id: latest_tag |
| 93 | +
|
| 94 | + - name: Bump patch version and update changelog |
39 | 95 | run: | |
40 | | - echo "tag=$(git describe --tags --abbrev=0 || echo 'v0.0.0')" >> $GITHUB_OUTPUT |
41 | | - - name: Generate changelog |
42 | | - run: | |
43 | | - echo "## Changelog" > CHANGELOG.md |
44 | | - echo "" >> CHANGELOG.md |
45 | | - git log ${{ steps.latest_tag.outputs.tag }}..HEAD --pretty=format:"- %s (%an)" >> CHANGELOG.md |
46 | | - - name: Bump patch version |
47 | | - run: |- |
48 | 96 | bump-my-version bump patch --verbose |
49 | | - git add CHANGELOG.md |
| 97 | + git add pyproject.toml CHANGELOG.md |
50 | 98 | git commit -m "bump: patch version + changelog [skip ci]" || echo "No changes to commit" |
51 | 99 | git push |
52 | 100 | git push --tags |
0 commit comments