name: Build Firefox Extension on: push: branches: - main tags: - 'v*' pull_request: branches: - main jobs: build: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Get version from manifest id: version run: | VERSION=$(jq -r '.version' manifest.json) echo "version=$VERSION" >> $GITHUB_OUTPUT echo "Building version: $VERSION" - name: Create extension package run: | # Create build directory mkdir -p build # Package the extension as XPI (which is just a ZIP file) zip -r build/container-bookmarks-${{ steps.version.outputs.version }}.xpi \ manifest.json \ background.js \ icons/ \ popup/ \ README.md \ -x "*.git*" \ -x "*.md" \ -x "build/*" \ -x "node_modules/*" \ -x ".gitea/*" # Also create a ZIP for convenience cp build/container-bookmarks-${{ steps.version.outputs.version }}.xpi \ build/container-bookmarks-${{ steps.version.outputs.version }}.zip - name: Upload artifact uses: actions/upload-artifact@v4 with: name: container-bookmarks-${{ steps.version.outputs.version }} path: build/*.xpi release: runs-on: ubuntu-latest needs: build if: startsWith(github.ref, 'refs/tags/v') steps: - name: Checkout repository uses: actions/checkout@v4 - name: Get version from manifest id: version run: | VERSION=$(jq -r '.version' manifest.json) echo "version=$VERSION" >> $GITHUB_OUTPUT - name: Download artifact uses: actions/download-artifact@v4 with: name: container-bookmarks-${{ steps.version.outputs.version }} path: build/ - name: Create Release uses: softprops/action-gh-release@v1 with: files: build/*.xpi generate_release_notes: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}