|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '*.*.*' |
| 7 | + - 'v*.*.*' |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + build-and-release: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout code |
| 18 | + uses: actions/checkout@v4 |
| 19 | + with: |
| 20 | + fetch-depth: 0 |
| 21 | + |
| 22 | + - name: Setup Node.js |
| 23 | + uses: actions/setup-node@v4 |
| 24 | + with: |
| 25 | + node-version: '20' |
| 26 | + |
| 27 | + - name: Setup pnpm |
| 28 | + uses: pnpm/action-setup@v4 |
| 29 | + with: |
| 30 | + version: 9 |
| 31 | + |
| 32 | + - name: Install dependencies |
| 33 | + run: pnpm install |
| 34 | + |
| 35 | + - name: Build Chrome extension |
| 36 | + run: pnpm build |
| 37 | + |
| 38 | + - name: Build Firefox extension |
| 39 | + run: pnpm build:firefox |
| 40 | + |
| 41 | + - name: Create Chrome zip |
| 42 | + run: | |
| 43 | + cd .output/chrome-mv3 |
| 44 | + zip -r ../../textchecker-chrome-${{ github.ref_name }}.zip . |
| 45 | + cd ../.. |
| 46 | +
|
| 47 | + - name: Create Firefox zip |
| 48 | + run: | |
| 49 | + cd .output/firefox-mv2 |
| 50 | + zip -r ../../textchecker-firefox-${{ github.ref_name }}.zip . |
| 51 | + cd ../.. |
| 52 | +
|
| 53 | + - name: Generate changelog |
| 54 | + id: changelog |
| 55 | + run: | |
| 56 | + # Get the previous tag |
| 57 | + PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") |
| 58 | +
|
| 59 | + if [ -z "$PREV_TAG" ]; then |
| 60 | + # First release - get all commits |
| 61 | + CHANGELOG=$(git log --pretty=format:"- %s (%h)" --no-merges) |
| 62 | + else |
| 63 | + # Get commits since last tag |
| 64 | + CHANGELOG=$(git log ${PREV_TAG}..HEAD --pretty=format:"- %s (%h)" --no-merges) |
| 65 | + fi |
| 66 | +
|
| 67 | + # Escape for GitHub Actions |
| 68 | + CHANGELOG="${CHANGELOG//'%'/'%25'}" |
| 69 | + CHANGELOG="${CHANGELOG//$'\n'/'%0A'}" |
| 70 | + CHANGELOG="${CHANGELOG//$'\r'/'%0D'}" |
| 71 | +
|
| 72 | + echo "changelog=$CHANGELOG" >> $GITHUB_OUTPUT |
| 73 | +
|
| 74 | + - name: Create Release |
| 75 | + uses: softprops/action-gh-release@v2 |
| 76 | + with: |
| 77 | + name: TextChecker ${{ github.ref_name }} |
| 78 | + body: | |
| 79 | + ## TextChecker ${{ github.ref_name }} |
| 80 | +
|
| 81 | + A free, open-source alternative to LanguageTool browser extension. |
| 82 | +
|
| 83 | + ### Installation |
| 84 | +
|
| 85 | + **Chrome / Edge / Brave:** |
| 86 | + 1. Download `textchecker-chrome-${{ github.ref_name }}.zip` |
| 87 | + 2. Extract the zip file |
| 88 | + 3. Go to `chrome://extensions/` |
| 89 | + 4. Enable "Developer mode" |
| 90 | + 5. Click "Load unpacked" and select the extracted folder |
| 91 | +
|
| 92 | + **Firefox:** |
| 93 | + 1. Download `textchecker-firefox-${{ github.ref_name }}.zip` |
| 94 | + 2. Go to `about:debugging#/runtime/this-firefox` |
| 95 | + 3. Click "Load Temporary Add-on" |
| 96 | + 4. Select any file from the extracted folder |
| 97 | +
|
| 98 | + ### Changes |
| 99 | +
|
| 100 | + ${{ steps.changelog.outputs.changelog }} |
| 101 | +
|
| 102 | + --- |
| 103 | +
|
| 104 | + **Full Changelog**: https://github.com/${{ github.repository }}/compare/${{ github.ref_name }}...HEAD |
| 105 | + files: | |
| 106 | + textchecker-chrome-${{ github.ref_name }}.zip |
| 107 | + textchecker-firefox-${{ github.ref_name }}.zip |
| 108 | + draft: false |
| 109 | + prerelease: false |
| 110 | + generate_release_notes: true |
0 commit comments