diff options
Diffstat (limited to 'R2R/.github/workflows/build-main.yml')
-rwxr-xr-x | R2R/.github/workflows/build-main.yml | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/R2R/.github/workflows/build-main.yml b/R2R/.github/workflows/build-main.yml new file mode 100755 index 00000000..b91de2c3 --- /dev/null +++ b/R2R/.github/workflows/build-main.yml @@ -0,0 +1,83 @@ +name: Build and Publish Docker Image + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to publish (leave empty to use default versioning)' + required: false + type: string + +jobs: + build-and-publish: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + id-token: write + actions: write + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Google Auth + uses: 'google-github-actions/auth@v2' + with: + credentials_json: '${{ secrets.GCP_SA_KEY }}' + + - name: Set up Cloud SDK + uses: 'google-github-actions/setup-gcloud@v2' + + - name: Configure SDK + run: 'gcloud auth configure-docker us-east1-docker.pkg.dev' + + - name: Docker Auth + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Determine version to use + id: version + run: | + if [ -n "${{ github.event.inputs.version }}" ]; then + echo "RELEASE_VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT + else + echo "RELEASE_VERSION=main" >> $GITHUB_OUTPUT + fi + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: | + emrgntcmplxty/r2r + us-east1-docker.pkg.dev/alert-rush-397022/sciphi-r2r/r2r + tags: | + type=raw,value=${{ steps.version.outputs.RELEASE_VERSION }} + type=raw,value=latest + + - name: Build and Push Docker Image + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + platforms: linux/amd64,linux/arm64 + + - name: Trigger Dependent Repositories + if: success() + run: | + curl -X POST \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}" \ + https://api.github.com/repos/SciPhi-AI/R2R-basic-rag-template/dispatches \ + -d '{"event_type": "rebuild", "client_payload": {"r2r_tag": "${{ steps.version.outputs.RELEASE_VERSION }}"}}' |