Skip to content

Commit a28997f

Browse files
committed
fix: simplify release workflow to use proper semantic-release approach
- Remove overcomplicated custom logic with version checks and conditionals - Use single 'semantic-release version' command as per official documentation - Eliminate redundant tasks: release:publish, release:setup-git, release:check-version, release:full - Simplify to single 'task release' that does everything semantic-release is designed to do - Remove GitHub Actions output logic since semantic-release handles everything internally - Fix release workflow to follow official python-semantic-release documentation This resolves the fundamental misunderstanding of how semantic-release works: - semantic-release version: does EVERYTHING (check, version, commit, tag, release) - semantic-release publish: only for uploading artifacts, not releasing Based on: https://python-semantic-release.readthedocs.io/en/latest/configuration/automatic-releases/github-actions.html#gh-actions-examples
1 parent e161641 commit a28997f

2 files changed

Lines changed: 6 additions & 47 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,12 @@ jobs:
5656
id: release
5757
env:
5858
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59-
run: |
60-
task release:full
61-
# Set GitHub Actions outputs for downstream jobs
62-
if [ -f .version.txt ] && [ "$(cat .version.txt)" != "0.0.0" ]; then
63-
echo "released=true" >> $GITHUB_OUTPUT
64-
echo "version=$(cat .version.txt)" >> $GITHUB_OUTPUT
65-
echo "tag=v$(cat .version.txt)" >> $GITHUB_OUTPUT
66-
else
67-
echo "released=false" >> $GITHUB_OUTPUT
68-
fi
59+
run: task release
6960

7061
update-lock:
7162
name: Update Poetry Lock
7263
runs-on: ubuntu-latest
7364
needs: release
74-
if: needs.release.outputs.released == 'true'
7565
steps:
7666
- name: Checkout code
7767
uses: actions/checkout@v4
@@ -102,7 +92,8 @@ jobs:
10292

10393
- name: Update Poetry lock file
10494
run: |
105-
task release:setup-git
95+
git config --global user.name "github-actions[bot]"
96+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
10697
task release:update-lock
10798
# Push changes if any were made
10899
if [ -n "$(git log --oneline HEAD~1..HEAD | grep 'chore: update poetry.lock')" ]; then

Taskfile.yml

Lines changed: 3 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -82,44 +82,12 @@ tasks:
8282
cmds:
8383
- poetry run semantic-release version --print
8484

85-
release:publish:
86-
desc: Publish a new release
87-
cmds:
88-
- poetry run semantic-release publish
89-
90-
release:setup-git:
91-
desc: Configure Git for automated releases
85+
release:
86+
desc: Run semantic release (determines if release needed and executes)
9287
cmds:
9388
- git config --global user.name "github-actions[bot]"
9489
- git config --global user.email "github-actions[bot]@users.noreply.github.com"
95-
96-
release:check-version:
97-
desc: Check if a new version should be released and output result
98-
cmds:
99-
- |
100-
poetry run semantic-release version --print > .version.txt 2>/dev/null || echo "0.0.0" > .version.txt
101-
if [ "$(cat .version.txt)" != "0.0.0" ]; then
102-
echo "New version: $(cat .version.txt)"
103-
echo "SHOULD_RELEASE=true" >> $GITHUB_ENV
104-
echo "NEW_VERSION=$(cat .version.txt)" >> $GITHUB_ENV
105-
echo "NEW_TAG=v$(cat .version.txt)" >> $GITHUB_ENV
106-
else
107-
echo "No release necessary"
108-
echo "SHOULD_RELEASE=false" >> $GITHUB_ENV
109-
fi
110-
111-
release:full:
112-
desc: Complete release workflow (check, publish if needed)
113-
cmds:
114-
- task: release:setup-git
115-
- task: release:check-version
116-
- |
117-
if [ "${SHOULD_RELEASE:-false}" = "true" ]; then
118-
echo "Publishing release..."
119-
task release:publish
120-
else
121-
echo "Skipping release - no changes requiring version bump"
122-
fi
90+
- poetry run semantic-release version
12391

12492
release:update-lock:
12593
desc: Update Poetry lock file after release

0 commit comments

Comments
 (0)