File tree Expand file tree Collapse file tree 3 files changed +36
-7
lines changed Expand file tree Collapse file tree 3 files changed +36
-7
lines changed Original file line number Diff line number Diff line change 1111    runs-on : ubuntu-latest 
1212    steps :
1313      - uses : actions/checkout@v5 
14+         with :
15+           fetch-depth : 0 
16+       - name : Verify tag is on main branch 
17+         run : | 
18+           # Get the commit SHA that the tag points to 
19+           TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref }}) 
20+           echo "Tag commit: $TAG_COMMIT" 
21+            
22+           # Check if this commit is on the main branch 
23+           if ! git branch -r --contains $TAG_COMMIT | grep -q 'origin/main'; then 
24+             echo "Error: Tag ${{ github.ref_name }} is not on the main branch" 
25+             echo "Releases can only be created from the main branch" 
26+             exit 1 
27+           fi 
28+            
29+           echo "Tag is on main branch, proceeding with release" 
1430       - name : Set up Python 3.12 
1531        uses : actions/setup-python@v5 
1632        with :
Original file line number Diff line number Diff line change @@ -131,13 +131,23 @@ Ready to release a new version **roslibpy**? Here's how to do it:
131131  * ``major ``: backwards-incompatible changes.
132132
133133* Update the ``CHANGELOG.rst `` with all novelty!
134- * Ready? Release everything in one command :
134+ * Create a release branch and prepare the release :
135135
136136::
137137
138+     git checkout -b release-x.y.z 
138139    invoke release [patch|minor|major] 
139140
140- * Profit!
141+ * This will run tests, bump the version, create a git tag, and commit changes.
142+ * Push the release branch and tag, then create a Pull Request to ``main ``:
143+ 
144+ ::
145+ 
146+     git push origin release-x.y.z 
147+     git push origin --tags 
148+ 
149+ * Once the PR is reviewed and merged into ``main ``, the release workflow will automatically publish to PyPI.
150+ * The workflow verifies the tag is on the ``main `` branch before publishing, preventing accidental releases from feature branches.
141151
142152
143153Credits
Original file line number Diff line number Diff line change @@ -179,11 +179,14 @@ def release(ctx, release_type):
179179    # Clean up local artifacts 
180180    clean (ctx )
181181
182-     # Upload to pypi 
183-     if  confirm ('Everything is ready. You are about to push to git which will trigger a release to pypi.org. Are you sure? [y/N]' ):
184-         ctx .run ('git push --tags && git push' )
185-     else :
186-         raise  Exit ('You need to manually revert the tag/commits created.' )
182+     log .write ('Release preparation complete!' )
183+     log .write ('Next steps:' )
184+     log .write ('  1. Push your release branch: git push origin <branch-name>' )
185+     log .write ('  2. Push the tag: git push origin --tags' )
186+     log .write ('  3. Create a Pull Request to main' )
187+     log .write ('  4. Once merged, the release will be automatically published to PyPI' )
188+     log .write ('' )
189+     log .write ('The release workflow will verify the tag is on main before publishing.' )
187190
188191
189192@contextlib .contextmanager  
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments