Skip to content

Conversation

@singhxabhijeet
Copy link
Contributor

@singhxabhijeet singhxabhijeet commented Oct 2, 2025

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:

  • Trigger automatically when a new version tag (e.g., v1.2.0) is pushed.
  • Update the version in frontend/manifest.json.
  • Commit the version bump and update the tag.
  • Build the frontend extension.
  • Package the dist folder into a CodeTranslateAI-vX.X.X.zip archive.
  • Create a new Draft Release on GitHub with the .zip file attached as an asset.

Copy link

@github-actions github-actions bot left a 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.

Copy link
Contributor

Copilot AI left a 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.

Comment on lines 44 to 62
# 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
Copy link

Copilot AI Oct 2, 2025

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.

Suggested change
# 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

Copilot uses AI. Check for mistakes.

- 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));"
Copy link

Copilot AI Oct 2, 2025

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.

Copilot uses AI. Check for mistakes.
Comment on lines 21 to 22
with:
fetch-depth: 0
Copy link

Copilot AI Oct 2, 2025

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.

Suggested change
with:
fetch-depth: 0
# with:
# fetch-depth: 0

Copilot uses AI. Check for mistakes.
@singhxabhijeet
Copy link
Contributor Author

singhxabhijeet commented Oct 7, 2025

Hi @dineshsutihar, I've updated the workflow based on the automated feedback.

  • The inline Node.js script has been moved to a separate file (.github/scripts/update-manifest.js) for better readability and maintenance.
  • I've kept git push --force for updating the tag, as this is necessary to include the version bump commit in the release tag itself. I've added a comment to the workflow to clarify this.
  • I also kept fetch-depth: 0 because it's required for the generate_release_notes feature to function correctly.

This should be ready for another review. Thanks!

Copy link
Collaborator

@dineshsutihar dineshsutihar left a 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!

@singhxabhijeet
Copy link
Contributor Author

Thank you so much @dineshsutihar for the review and the merge! I'm glad I could contribute and really enjoyed working on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(CI/CD): Automate extension packaging and release drafting

2 participants