chore: bump version to 0.1.1 #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| packages: write | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: onllm-dev/4dpocket | |
| jobs: | |
| # ─── Extract version from tag ───────────────────────────────── | |
| meta: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| tag: ${{ steps.version.outputs.tag }} | |
| steps: | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| VERSION="${TAG#v}" | |
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "Version: $VERSION (tag: $TAG)" | |
| # ─── Build & push Docker image to GHCR ──────────────────────── | |
| docker: | |
| runs-on: ubuntu-latest | |
| needs: meta | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker meta (tags + labels) | |
| id: docker-meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.docker-meta.outputs.tags }} | |
| labels: ${{ steps.docker-meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| platforms: linux/amd64,linux/arm64 | |
| # ─── Build Python package ────────────────────────────────────── | |
| python: | |
| runs-on: ubuntu-latest | |
| needs: meta | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install build tools | |
| run: pip install build | |
| - name: Verify version matches tag | |
| run: | | |
| PKG_VERSION=$(python -c " | |
| import re | |
| with open('pyproject.toml') as f: | |
| m = re.search(r'version\s*=\s*\"(.+?)\"', f.read()) | |
| print(m.group(1)) | |
| ") | |
| if [ "$PKG_VERSION" != "${{ needs.meta.outputs.version }}" ]; then | |
| echo "ERROR: pyproject.toml version ($PKG_VERSION) != tag (${{ needs.meta.outputs.version }})" | |
| exit 1 | |
| fi | |
| - name: Build sdist and wheel | |
| run: python -m build | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-dist | |
| path: dist/ | |
| # ─── Build Chrome extension ──────────────────────────────────── | |
| extension: | |
| runs-on: ubuntu-latest | |
| needs: meta | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install pnpm | |
| run: corepack enable | |
| - name: Install dependencies | |
| working-directory: extension | |
| run: pnpm install --frozen-lockfile | |
| - name: Build Chrome extension | |
| working-directory: extension | |
| run: pnpm build | |
| - name: Zip extension | |
| run: | | |
| cd extension/dist/chrome-mv3 | |
| zip -r ../../../4dpocket-chrome-extension-${{ needs.meta.outputs.version }}.zip . | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: chrome-extension | |
| path: 4dpocket-chrome-extension-${{ needs.meta.outputs.version }}.zip | |
| # ─── Create GitHub Release ───────────────────────────────────── | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: [meta, docker, python, extension] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download Python artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-dist | |
| path: dist/ | |
| - name: Download Chrome extension | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: chrome-extension | |
| path: . | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.meta.outputs.tag }} | |
| name: 4DPocket ${{ needs.meta.outputs.tag }} | |
| generate_release_notes: true | |
| files: | | |
| dist/* | |
| 4dpocket-chrome-extension-${{ needs.meta.outputs.version }}.zip | |
| body: | | |
| ## Install | |
| **Docker (recommended):** | |
| ```bash | |
| docker pull ghcr.io/onllm-dev/4dpocket:${{ needs.meta.outputs.version }} | |
| ``` | |
| **Docker Compose:** | |
| ```bash | |
| curl -O https://raw.githubusercontent.com/onllm-dev/4DPocket/${{ needs.meta.outputs.tag }}/docker-compose.yml | |
| curl -O https://raw.githubusercontent.com/onllm-dev/4DPocket/${{ needs.meta.outputs.tag }}/.env.example | |
| cp .env.example .env | |
| docker compose up -d | |
| ``` | |
| **Python:** | |
| ```bash | |
| pip install fourdpocket==${{ needs.meta.outputs.version }} | |
| ``` | |
| ## Chrome Extension | |
| 1. Download `4dpocket-chrome-extension-${{ needs.meta.outputs.version }}.zip` from the assets below | |
| 2. Unzip it | |
| 3. Go to `chrome://extensions`, enable **Developer mode** | |
| 4. Click **Load unpacked** and select the unzipped folder | |
| 5. Click the extension icon, open **Settings**, enter your server URL and login | |
| # ─── Publish to PyPI (optional, requires PYPI_TOKEN secret) ─── | |
| pypi: | |
| runs-on: ubuntu-latest | |
| needs: [meta, python] | |
| if: ${{ vars.PUBLISH_PYPI == 'true' }} | |
| environment: pypi | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-dist | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_TOKEN }} |