1+ # .github/workflows/release.yml
2+
3+ name : Create Draft Release
4+
5+ on :
6+ push :
7+ tags :
8+ - ' v*.*.*'
9+
10+ permissions :
11+ contents : write
12+ pull-requests : read
13+
14+ jobs :
15+ release :
16+ name : Create Draft Release
17+ runs-on : ubuntu-latest
18+ steps :
19+ - name : Checkout code
20+ uses : actions/checkout@v4
21+ with :
22+ fetch-depth : 0
23+
24+ - name : Setup Node.js
25+ uses : actions/setup-node@v4
26+ with :
27+ node-version : ' 18'
28+
29+ - name : Install frontend dependencies
30+ run : npm ci
31+ working-directory : ./frontend
32+
33+ - name : Update manifest.json version
34+ run : |
35+ 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));"
36+ echo "frontend/manifest.json updated to version ${{ github.ref_name }}"
37+
38+ - name : Commit and Update Tag
39+ run : |
40+ git config --global user.name 'github-actions[bot]'
41+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
42+ git add frontend/manifest.json
43+ git commit -m "chore: Bump frontend version to ${{ github.ref_name }}"
44+ # This command updates the tag to point to the new commit
45+ git push origin --force ${{ github.ref_name }}
46+
47+ - name : Build frontend extension
48+ run : npm run build
49+ working-directory : ./frontend
50+
51+ - name : Create ZIP archive
52+ run : zip -r ../../CodeTranslateAI-${{ github.ref_name }}.zip .
53+ working-directory : ./frontend/dist
54+
55+ - name : Create Draft GitHub Release
56+ uses : softprops/action-gh-release@v2
57+ with :
58+ token : ${{ secrets.GITHUB_TOKEN }}
59+ tag_name : ${{ github.ref_name }}
60+ draft : true
61+ generate_release_notes : true
62+ files : CodeTranslateAI-${{ github.ref_name }}.zip
0 commit comments