feat(workspace): add worktree-based isolated development functionality #406
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: Build and Release | |
| on: | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - "crates/*/Cargo.toml" | |
| - "src/**" | |
| - "python/**" | |
| - "packages/*/python/**" | |
| - "packages/*/src/**" | |
| - "**/pyproject.toml" | |
| - "**/cargo.toml" | |
| pull_request: | |
| branches: | |
| - master | |
| paths: | |
| - "crates/*/Cargo.toml" | |
| - "src/**" | |
| - "python/**" | |
| - "packages/*/python/**" | |
| - "packages/*/src/**" | |
| - "**/pyproject.toml" | |
| - "**/cargo.toml" | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| determine_changes: | |
| name: Determine Release Necessity & Version Details | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version_changed: ${{ steps.check_version_change.outputs.VERSION_CHANGED }} | |
| current_version: ${{ steps.get_version.outputs.CURRENT_VERSION }} | |
| is_prerelease: ${{ steps.check_prerelease.outputs.IS_PRERELEASE }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Get current version from pyproject.toml | |
| id: get_version | |
| run: | | |
| CURRENT_VERSION_RAW=$(grep '^version' pyproject.toml | cut -d '"' -f 2) | |
| echo "CURRENT_VERSION=v$CURRENT_VERSION_RAW" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Get latest git tag | |
| uses: JinoArch/get-latest-tag@latest | |
| id: tag | |
| - name: Check if version has changed against latest tag | |
| id: check_version_change | |
| run: | | |
| LATEST_TAG=${{ steps.tag.outputs.latestTag }} | |
| VERSION_FROM_PYPROJECT=${{ steps.get_version.outputs.CURRENT_VERSION }} | |
| echo "Latest git tag is $LATEST_TAG" | |
| echo "Current version (from pyproject.toml, prefixed with 'v') is $VERSION_FROM_PYPROJECT" | |
| if [ "$LATEST_TAG" != "$VERSION_FROM_PYPROJECT" ]; then | |
| echo "VERSION_CHANGED=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "VERSION_CHANGED=false" >> $GITHUB_OUTPUT | |
| fi | |
| shell: bash | |
| - name: Check if current version is a prerelease | |
| id: check_prerelease | |
| run: | | |
| VERSION_FROM_PYPROJECT=${{ steps.get_version.outputs.CURRENT_VERSION }} | |
| if [[ "$VERSION_FROM_PYPROJECT" == *"-"* ]]; then # e.g., v1.0.0-alpha | |
| echo "IS_PRERELEASE=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "IS_PRERELEASE=false" >> $GITHUB_OUTPUT | |
| fi | |
| shell: bash | |
| create-release: | |
| if: needs.determine_changes.outputs.version_changed == 'true' && github.event_name != 'pull_request' | |
| name: Create Release | |
| needs: determine_changes | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Packing templates | |
| run: | | |
| tar -czf templates.tar.gz templates | |
| - name: Create Release and upload assets | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.determine_changes.outputs.current_version }} | |
| name: ${{ needs.determine_changes.outputs.current_version }} | |
| files: | | |
| templates.tar.gz | |
| prerelease: ${{ needs.determine_changes.outputs.is_prerelease }} | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PAT }} | |
| check-and-release: | |
| name: Build, Package, and Release | |
| needs: | |
| - create-release | |
| - determine_changes | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ windows-latest, ubuntu-latest, ubuntu-24.04-arm, macos-latest ] | |
| python-version: [ "3.12", "3.13" ,"3.14" ] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - uses: extractions/setup-just@v3 | |
| with: | |
| github-token: ${{ secrets.PAT }} | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| version: "latest" | |
| - name: Install nightly rust | |
| run: | | |
| rustup default nightly | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.PAT }} | |
| - uses: actions/setup-node@v6 | |
| name: Setup Node.js | |
| continue-on-error: true | |
| with: | |
| node-version: 22 | |
| cache: 'pnpm' | |
| cache-dependency-path: 'packages/fabricatio-webui/frontend/pnpm-lock.yaml' | |
| - name: Setup Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install deps | |
| run: | | |
| uv sync --no-install-project --only-dev --index https://pypi.org/simple -p ${{ matrix.python-version }} | |
| env: | |
| UV_HTTP_TIMEOUT: 300 | |
| - name: Cache cargo registry | |
| id: cache-registry | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| key: ${{ runner.os }}-cargo-registry-v1 | |
| restore-keys: | | |
| ${{ runner.os }}-cargo-registry- | |
| - name: Upload to PyPI | |
| if: needs.determine_changes.outputs.version_changed == 'true' && github.event_name != 'pull_request' | |
| run: | | |
| npm install -g pnpm | |
| just publish ${{ matrix.python-version }} "${{ matrix.os }}-${{ matrix.python-version }}" | |
| shell: bash | |
| env: | |
| MATURIN_USERNAME: __token__ | |
| MATURIN_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
| UV_INDEX: https://pypi.org/simple | |
| UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} | |
| - name: Move Generic whl | |
| if: needs.determine_changes.outputs.version_changed == 'true' && github.event_name != 'pull_request' | |
| run: | | |
| mkdir ${{ matrix.os }}-${{ matrix.python-version }}-generic | |
| mv ${{ matrix.os }}-${{ matrix.python-version }}/*-none-any.whl ${{ matrix.os }}-${{ matrix.python-version }}-generic/ | |
| - name: Upload assets | |
| if: needs.determine_changes.outputs.version_changed == 'true' && github.event_name != 'pull_request' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.determine_changes.outputs.current_version }} | |
| files: | | |
| ${{ matrix.os }}-${{ matrix.python-version }}/*.whl | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PAT }} | |
| - name: Upload generic assets | |
| if: needs.determine_changes.outputs.version_changed == 'true' && github.event_name != 'pull_request' | |
| continue-on-error: true | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ needs.determine_changes.outputs.current_version }} | |
| files: | | |
| ${{ matrix.os }}-${{ matrix.python-version }}-generic/*.whl | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PAT }} | |
| - name: Upload build logs | |
| if: needs.determine_changes.outputs.version_changed == 'true' && github.event_name != 'pull_request' | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: logs-${{ matrix.os }}-${{ matrix.python-version }} | |
| path: logs/** | |
| retention-days: 90 | |
| compression-level: 6 | |
| overwrite: true |