v0.1.4 #8
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
| # .github/workflows/release.yml | |
| # Build distributions on GitHub Release and publish to PyPI (Trusted Publishers) | |
| # Automatically patches version from the release tag before building. | |
| name: Build & Publish to PyPI | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: write # upload assets to GitHub release | |
| id-token: write # required for PyPI Trusted Publishing (OIDC) | |
| jobs: | |
| build: | |
| name: Build distributions | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Extract version from release tag | |
| id: version | |
| run: | | |
| RAW="${GITHUB_REF#refs/tags/}" | |
| SEMVER="${RAW#v}" | |
| echo "VERSION=$SEMVER" >> "$GITHUB_ENV" | |
| echo "📦 Building version: $SEMVER" | |
| - name: Patch pyproject.toml version | |
| run: | | |
| sed -i "s/^version = \".*\"/version = \"$VERSION\"/" pyproject.toml | |
| echo "✅ pyproject.toml → $VERSION" | |
| grep '^version' pyproject.toml | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.11" | |
| cache: "pip" | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| run: | | |
| cd frontend | |
| npm ci | |
| - name: Build frontend | |
| run: | | |
| cd frontend | |
| npm run build | |
| - name: Install build backend | |
| run: | | |
| python -m pip install --upgrade pip build | |
| - name: Build wheel and sdist | |
| run: | | |
| # Just in case, ensure clean dist/ in the CI workspace | |
| rm -rf dist build | |
| python -m build | |
| - name: Upload artefacts to the GitHub release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| dist/*.whl | |
| dist/*.tar.gz | |
| - name: Persist artefacts for publish job | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-dists | |
| path: dist/ | |
| publish: | |
| name: Publish to PyPI | |
| runs-on: ubuntu-latest | |
| needs: build | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/project/gitcopilot/ | |
| steps: | |
| - name: Download artefacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: python-dists | |
| path: dist/ | |
| - name: Publish via Trusted Publishing | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # no extra config needed; it will upload dist/* using OIDC |