name: Release packages on: workflow_dispatch: push: tags: ['v*'] permissions: contents: read concurrency: group: package-publication cancel-in-progress: false jobs: quality: if: github.event_name == 'workflow_dispatch' || vars.PUBLISH_ENABLED == 'true' uses: ./.github/workflows/python-quality.yml build: if: github.event_name == 'workflow_dispatch' || vars.PUBLISH_ENABLED == 'true' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: persist-credentials: false - uses: actions/setup-python@v5 with: python-version: '3.13' - uses: actions/setup-node@v4 with: node-version: '24' - name: Install build tools run: python -m pip install build twine - name: Build and check release artifacts env: RELEASE_TAG: ${{ github.ref_name }} run: | if [ "$GITHUB_EVENT_NAME" = workflow_dispatch ]; then RELEASE_TAG="v$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')" fi python -m build --outdir dist npm pack ./npm --pack-destination dist python scripts/check_release_artifacts.py dist "$RELEASE_TAG" python -m twine check dist/*.whl dist/*.tar.gz cd dist sha256sum *.whl *.tar.gz *.tgz | sort -k2 > SHA256SUMS cat SHA256SUMS - uses: actions/upload-artifact@v4 with: name: release-artifacts path: dist/* if-no-files-found: error installed-artifact: if: github.event_name == 'workflow_dispatch' || vars.PUBLISH_ENABLED == 'true' needs: build runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: persist-credentials: false - uses: actions/setup-python@v5 with: python-version: '3.13' - uses: actions/setup-node@v4 with: node-version: '24' - uses: pnpm/action-setup@v4 with: version: '10' - uses: astral-sh/setup-uv@v6 with: version: '0.8.22' - uses: actions/download-artifact@v4 with: name: release-artifacts path: dist - name: Verify and install the exact artifacts run: | cd dist sha256sum -c SHA256SUMS uv venv --python 3.13 "$RUNNER_TEMP/rag-installed" uv pip install --python "$RUNNER_TEMP/rag-installed/bin/python" ./*.whl uvx --from ./*.whl rag --help > /dev/null - name: Exercise installed launcher and MCP search run: | export WHEEL=$(echo "$GITHUB_WORKSPACE"/dist/*.whl) export NPM_TGZ=$(echo "$GITHUB_WORKSPACE"/dist/*.tgz) export FACTS="$GITHUB_WORKSPACE/tests/install/facts.md" cd "$RUNNER_TEMP" env -u PYTHONPATH bash "$GITHUB_WORKSPACE/tests/install/smoke.sh" publish-pypi: if: github.event_name == 'push' && vars.PUBLISH_ENABLED == 'true' needs: [build, quality, installed-artifact] runs-on: ubuntu-latest environment: pypi permissions: contents: read id-token: write steps: - uses: actions/download-artifact@v4 with: name: release-artifacts path: dist - run: | cd dist sha256sum -c SHA256SUMS mkdir python mv *.whl *.tar.gz python/ - uses: pypa/gh-action-pypi-publish@release/v1 with: packages-dir: dist/python/ publish-npm: if: github.event_name == 'push' && vars.PUBLISH_ENABLED == 'true' needs: [build, publish-pypi] runs-on: ubuntu-latest environment: npm permissions: contents: read id-token: write steps: - uses: actions/setup-node@v4 with: node-version: '24' registry-url: https://registry.npmjs.org - uses: actions/download-artifact@v4 with: name: release-artifacts path: dist - name: Verify hashes and publish launcher run: | cd dist sha256sum -c SHA256SUMS npm publish ./*.tgz --provenance --access public