feat: Make prompt provider methods asynchronous (comments below) (#1415) #231
Workflow file for this run
This file contains 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 Publish R2R Docker Image | |
on: | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Branch to simulate (e.g., dev, dev-minor, main)' | |
required: false | |
default: 'main' | |
push: | |
branches: | |
- dev | |
- dev-minor | |
env: | |
REGISTRY_BASE: ragtoriches | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
outputs: | |
release_version: ${{ steps.version.outputs.RELEASE_VERSION }} | |
registry_image: ${{ steps.version.outputs.REGISTRY_IMAGE }} | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.branch || github.ref }} # This checks out the correct branch | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Install toml package | |
run: pip install toml | |
- name: Determine version and registry | |
id: version | |
run: | | |
VERSION=$(python -c "import toml; print(toml.load('py/pyproject.toml')['tool']['poetry']['version'])") | |
RELEASE_VERSION=$VERSION | |
# Use input branch if this is a workflow dispatch | |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
BRANCH="${{ github.event.inputs.branch }}" | |
else | |
BRANCH="${{ github.ref }}" | |
fi | |
# Determine the registry based on the branch | |
if [ "$BRANCH" == "refs/heads/dev" ] || [ "$BRANCH" == "dev" ]; then | |
REGISTRY_IMAGE="${{ env.REGISTRY_BASE }}/dev" | |
elif [ "$BRANCH" == "refs/heads/dev-minor" ] || [ "$BRANCH" == "dev-minor" ]; then | |
REGISTRY_IMAGE="${{ env.REGISTRY_BASE }}/dev-minor" | |
else | |
REGISTRY_IMAGE="${{ env.REGISTRY_BASE }}/prod" | |
fi | |
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT | |
echo "REGISTRY_IMAGE=$REGISTRY_IMAGE" >> $GITHUB_OUTPUT | |
- name: Set matrix | |
id: set-matrix | |
run: | | |
echo "matrix={\"include\":[{\"platform\":\"amd64\",\"runner\":\"amd2\"},{\"platform\":\"arm64\",\"runner\":\"arm2\"}]}" >> $GITHUB_OUTPUT | |
build: | |
needs: prepare | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.prepare.outputs.matrix)}} | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ needs.prepare.outputs.BRANCH }} | |
- name: Echo Commit Hash | |
run: | | |
COMMIT_HASH=$(git rev-parse HEAD) | |
echo "Building commit hash: $COMMIT_HASH" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker Auth | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.RAGTORICHES_DOCKER_UNAME }} | |
password: ${{ secrets.RAGTORICHES_DOCKER_TOKEN }} | |
- name: Build and push image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./py | |
file: ./py/Dockerfile | |
platforms: ${{ matrix.platform }} | |
no-cache: true | |
push: true | |
tags: | | |
${{ needs.prepare.outputs.REGISTRY_IMAGE }}:${{ needs.prepare.outputs.release_version }}-${{ matrix.platform }} | |
${{ needs.prepare.outputs.REGISTRY_IMAGE }}:latest-${{ matrix.platform }} | |
provenance: false | |
sbom: false | |
create-manifest: | |
needs: [prepare, build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Docker Auth | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.RAGTORICHES_DOCKER_UNAME }} | |
password: ${{ secrets.RAGTORICHES_DOCKER_TOKEN }} | |
- name: Create and push multi-arch manifest | |
run: | | |
docker buildx imagetools create -t ${{ needs.prepare.outputs.REGISTRY_IMAGE }}:${{ needs.prepare.outputs.release_version }} \ | |
${{ needs.prepare.outputs.REGISTRY_IMAGE }}:${{ needs.prepare.outputs.release_version }}-amd64 \ | |
${{ needs.prepare.outputs.REGISTRY_IMAGE }}:${{ needs.prepare.outputs.release_version }}-arm64 | |
docker buildx imagetools create -t ${{ needs.prepare.outputs.REGISTRY_IMAGE }}:latest \ | |
${{ needs.prepare.outputs.REGISTRY_IMAGE }}:${{ needs.prepare.outputs.release_version }}-amd64 \ | |
${{ needs.prepare.outputs.REGISTRY_IMAGE }}:${{ needs.prepare.outputs.release_version }}-arm64 | |
- name: Verify manifests | |
run: | | |
docker buildx imagetools inspect ${{ needs.prepare.outputs.REGISTRY_IMAGE }}:${{ needs.prepare.outputs.release_version }} | |
docker buildx imagetools inspect ${{ needs.prepare.outputs.REGISTRY_IMAGE }}:latest |