Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# .github/workflows/release.yml

name: Create Draft Release

on:
push:
tags:
- 'v*.*.*'

permissions:
contents: write
pull-requests: read

jobs:
release:
name: Create Draft Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
Comment on lines 22 to 24
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.

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install frontend dependencies
run: npm ci
working-directory: ./frontend

- 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.
echo "frontend/manifest.json updated to version ${{ github.ref_name }}"

- name: Commit and Update Tag
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
git add frontend/manifest.json
git commit -m "chore: Bump frontend version to ${{ github.ref_name }}"
# 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
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.