- 
                Notifications
    You must be signed in to change notification settings 
- Fork 11
feat: Add GitHub Action to automate releases #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add GitHub Action to automate releases #49
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @singhxabhijeet! 🎉
Welcome, and thank you for submitting your first pull request to CodeTranslateAI! We're thrilled to have your contribution.
Please make sure you've read our CONTRIBUTING.md guide. We'll review your changes shortly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a GitHub Actions workflow to automate the release process by creating draft releases when version tags are pushed. The workflow eliminates manual steps and reduces errors in the release process.
Key changes:
- Automated release workflow triggered by version tags (v*..)
- Automatic version updates in manifest.json and tag management
- Automated frontend building and ZIP packaging for releases
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
        
          
                .github/workflows/release.yml
              
                Outdated
          
        
      | # This command updates the tag to point to the new commit | ||
| git push origin --force ${{ github.ref_name }} | ||
|  | ||
| - name: Build frontend extension | ||
| run: npm run build | ||
| working-directory: ./frontend | ||
|  | ||
| - name: Create ZIP archive | ||
| run: zip -r ../../CodeTranslateAI-${{ github.ref_name }}.zip . | ||
| working-directory: ./frontend/dist | ||
|  | ||
| - name: Create Draft GitHub Release | ||
| uses: softprops/action-gh-release@v2 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| tag_name: ${{ github.ref_name }} | ||
| draft: true | ||
| generate_release_notes: true | ||
| files: CodeTranslateAI-${{ github.ref_name }}.zip No newline at end of file | 
    
      
    
      Copilot
AI
    
    
    
      Oct 2, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using --force to update tags can be dangerous as it overwrites the original tag reference. This could cause issues if other workflows or processes depend on the original tag commit. Consider using a different approach like creating a new tag or documenting this behavior clearly.
| # This command updates the tag to point to the new commit | |
| git push origin --force ${{ github.ref_name }} | |
| - name: Build frontend extension | |
| run: npm run build | |
| working-directory: ./frontend | |
| - name: Create ZIP archive | |
| run: zip -r ../../CodeTranslateAI-${{ github.ref_name }}.zip . | |
| working-directory: ./frontend/dist | |
| - name: Create Draft GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag_name: ${{ github.ref_name }} | |
| draft: true | |
| generate_release_notes: true | |
| files: CodeTranslateAI-${{ github.ref_name }}.zip | |
| # Instead of force-pushing the existing tag, create a new tag for the updated commit | |
| NEW_TAG="${{ github.ref_name }}-build" | |
| git tag "$NEW_TAG" | |
| git push origin "$NEW_TAG" | |
| echo "Created and pushed new tag: $NEW_TAG" | |
| - name: Build frontend extension | |
| run: npm run build | |
| working-directory: ./frontend | |
| - name: Create ZIP archive | |
| run: zip -r ../../CodeTranslateAI-${{ github.ref_name }}-build.zip . | |
| working-directory: ./frontend/dist | |
| - name: Create Draft GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| tag_name: ${{ github.ref_name }}-build | |
| draft: true | |
| generate_release_notes: true | |
| files: CodeTranslateAI-${{ github.ref_name }}-build.zip | 
        
          
                .github/workflows/release.yml
              
                Outdated
          
        
      |  | ||
| - name: Update manifest.json version | ||
| run: | | ||
| node -e "let manifest = require('./frontend/manifest.json'); manifest.version = '${{ github.ref_name }}'.substring(1); require('fs').writeFileSync('./frontend/manifest.json', JSON.stringify(manifest, null, 2));" | 
    
      
    
      Copilot
AI
    
    
    
      Oct 2, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This inline Node.js script is difficult to read and maintain. Consider extracting this logic into a separate script file or using a more readable multi-line format.
| with: | ||
| fetch-depth: 0 | 
    
      
    
      Copilot
AI
    
    
    
      Oct 2, 2025 
    
  
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using fetch-depth: 0 fetches the entire git history which may be unnecessary for this workflow. Consider using a shallow clone (default behavior) unless the full history is specifically needed.
| with: | |
| fetch-depth: 0 | |
| # with: | |
| # fetch-depth: 0 | 
| Hi @dineshsutihar, I've updated the workflow based on the automated feedback. 
 This should be ready for another review. Thanks! | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, @singhxabhijeet ! 👏
I’ve made a few small tweaks, but your PR was solid. Thanks for contributing!
| Thank you so much @dineshsutihar for the review and the merge! I'm glad I could contribute and really enjoyed working on this. | 
Resolves #47
This pull request automates the release process using a GitHub Action, solving the manual and error-prone steps previously required.
The new workflow will:
v1.2.0) is pushed.versioninfrontend/manifest.json.distfolder into aCodeTranslateAI-vX.X.X.ziparchive..zipfile attached as an asset.