|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + |
| 8 | +jobs: |
| 9 | + build-and-release: |
| 10 | + runs-on: ubuntu-latest |
| 11 | + |
| 12 | + steps: |
| 13 | + - name: Checkout code |
| 14 | + uses: actions/checkout@v4 |
| 15 | + |
| 16 | + - name: Extract version from tag |
| 17 | + id: version |
| 18 | + run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT |
| 19 | + |
| 20 | + - name: Verify version matches manifest |
| 21 | + run: | |
| 22 | + MANIFEST_VERSION=$(grep -oP '"version":\s*"\K[^"]+' comping/manifest.json) |
| 23 | + if [ "$MANIFEST_VERSION" != "${{ steps.version.outputs.VERSION }}" ]; then |
| 24 | + echo "Error: Tag version (${{ steps.version.outputs.VERSION }}) doesn't match manifest.json version ($MANIFEST_VERSION)" |
| 25 | + exit 1 |
| 26 | + fi |
| 27 | +
|
| 28 | + - name: Build extension |
| 29 | + run: | |
| 30 | + chmod +x build-extension.sh |
| 31 | + ./build-extension.sh |
| 32 | +
|
| 33 | + - name: Create Release |
| 34 | + id: create_release |
| 35 | + uses: actions/create-release@v1 |
| 36 | + env: |
| 37 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 38 | + with: |
| 39 | + tag_name: ${{ github.ref }} |
| 40 | + release_name: Release ${{ steps.version.outputs.VERSION }} |
| 41 | + body: | |
| 42 | + ## Comping v${{ steps.version.outputs.VERSION }} |
| 43 | +
|
| 44 | + ### Installation |
| 45 | +
|
| 46 | + **Firefox:** |
| 47 | + - Download `comping-${{ steps.version.outputs.VERSION }}.xpi` |
| 48 | + - See [INSTALLATION.md](https://github.com/${{ github.repository }}/blob/main/INSTALLATION.md) for installation instructions |
| 49 | +
|
| 50 | + **Chrome:** |
| 51 | + - Download `comping-${{ steps.version.outputs.VERSION }}-chrome.zip` |
| 52 | + - Extract and load as unpacked extension in developer mode |
| 53 | +
|
| 54 | + ### What's Changed |
| 55 | + <!-- Add your changelog here --> |
| 56 | +
|
| 57 | + **Full Changelog**: https://github.com/${{ github.repository }}/compare/v${{ steps.version.outputs.VERSION }}...HEAD |
| 58 | + draft: false |
| 59 | + prerelease: false |
| 60 | + |
| 61 | + - name: Upload Firefox XPI |
| 62 | + uses: actions/upload-release-asset@v1 |
| 63 | + env: |
| 64 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + with: |
| 66 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 67 | + asset_path: ./build/comping-${{ steps.version.outputs.VERSION }}.xpi |
| 68 | + asset_name: comping-${{ steps.version.outputs.VERSION }}.xpi |
| 69 | + asset_content_type: application/x-xpinstall |
| 70 | + |
| 71 | + - name: Upload Chrome ZIP |
| 72 | + uses: actions/upload-release-asset@v1 |
| 73 | + env: |
| 74 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 75 | + with: |
| 76 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 77 | + asset_path: ./build/comping-${{ steps.version.outputs.VERSION }}-chrome.zip |
| 78 | + asset_name: comping-${{ steps.version.outputs.VERSION }}-chrome.zip |
| 79 | + asset_content_type: application/zip |
0 commit comments