|
| 1 | +# .github/workflows/release.yml |
| 2 | + |
| 3 | +name: Create Draft Release |
| 4 | + |
| 5 | +on: |
| 6 | + push: |
| 7 | + tags: |
| 8 | + - 'v*.*.*' |
| 9 | + - 'v*.*.*-*' # also handle pre-releases like v1.2.3-beta.1 |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | + pull-requests: read |
| 14 | + |
| 15 | +jobs: |
| 16 | + release: |
| 17 | + name: Create Draft Release |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + # Full history is required for the release notes generator |
| 24 | + fetch-depth: 0 |
| 25 | + |
| 26 | + - name: Setup Node.js |
| 27 | + uses: actions/setup-node@v4 |
| 28 | + with: |
| 29 | + node-version: '18' |
| 30 | + |
| 31 | + - name: Install frontend dependencies |
| 32 | + run: npm ci |
| 33 | + working-directory: ./frontend |
| 34 | + |
| 35 | + - name: Update manifest.json version |
| 36 | + run: node .github/scripts/update-manifest.js |
| 37 | + |
| 38 | + - name: Commit and Update Tag |
| 39 | + run: | |
| 40 | + git config --global user.name 'CodeTranslate Release Bot' |
| 41 | + git config --global user.email 'release-bot-codetranslate@users.noreply.github.com' |
| 42 | + git add frontend/manifest.json |
| 43 | + # This command updates the tag to point to the new commit |
| 44 | + git commit -m "chore: bump manifest version to ${{ github.ref_name }} [skip ci]" || echo "No changes to commit" |
| 45 | + git push origin HEAD:main |
| 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 |
| 63 | + prerelease: ${{ contains(github.ref_name, '-') }} |
0 commit comments