Build and publish #519
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 | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 1 * * *" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
provider: [pinecone, weaviate, zilliz, milvus, qdrant, redis, llamaindex, chroma, azure, supabase, postgres, analyticdb, elasticsearch, azurecosmosdb] | |
continue-on-error: true | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: AWS CLI v2 | |
uses: imehedi/actions-awscli-v2@latest | |
continue-on-error: true | |
with: | |
args: s3 cp s3://${{ vars.SC_ARTIFACTS_BUCKET }}/chatgpt-retrieval-plugin-docker/${{ matrix.provider }}/REVISION . --endpoint-url ${{ vars.SC_AMS_AWS_ENDPOINT }} | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.SC_AWS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.SC_AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: "nl-ams" | |
- name: Tag | |
id: tag | |
run: | | |
git clone --branch main --depth 1 https://github.com/openai/chatgpt-retrieval-plugin.git | |
REPO_COMMIT_SHA=$(git --git-dir=chatgpt-retrieval-plugin/.git rev-parse --short HEAD) | |
PREVIOUS_COMMIT_SHA=$(cat REVISION || echo "") | |
mkdir temp/ | |
if [ "$REPO_COMMIT_SHA" = "$PREVIOUS_COMMIT_SHA" ]; then | |
echo "No new commits. Skipping." | |
echo "skipped=true" >> $GITHUB_OUTPUT | |
echo $REPO_COMMIT_SHA > temp/REVISION | |
exit 0 | |
fi | |
VERSION="${{ matrix.provider }}-$REPO_COMMIT_SHA-$(date +%s)" | |
echo "VERSION=$VERSION" >> $GITHUB_ENV | |
echo $REPO_COMMIT_SHA > temp/REVISION | |
python -m pip install --upgrade pip | |
pip install toml | |
python manage_deps.py ${{ matrix.provider }} | |
- name: AWS CLI v2 | |
uses: imehedi/actions-awscli-v2@latest | |
with: | |
args: s3 cp temp/REVISION s3://${{ vars.SC_ARTIFACTS_BUCKET }}/chatgpt-retrieval-plugin-docker/${{ matrix.provider }}/REVISION --endpoint-url ${{ vars.SC_AMS_AWS_ENDPOINT }} | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.SC_AWS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.SC_AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: "nl-ams" | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
if: ${{ steps.tag.outputs.skipped != 'true' }} | |
uses: docker/metadata-action@v4 | |
with: | |
images: ghcr.io/icoretech/chatgpt-retrieval-plugin-docker | |
labels: | | |
io.artifacthub.package.category=ai-machine-learning | |
io.artifacthub.package.keywords=openai,chatgpt | |
io.artifacthub.package.license=MIT | |
io.artifacthub.package.maintainers=[{"name":"Claudio Poli","email":"claudio@icorete.ch"}] | |
io.artifacthub.package.readme-url=https://github.com/icoretech/chatgpt-retrieval-plugin-docker/blob/main/README.md | |
org.opencontainers.image.description=chatgpt-retrieval-plugin | |
org.opencontainers.image.source=https://github.com/icoretech/chatgpt-retrieval-plugin-docker | |
org.opencontainers.image.title=chatgpt-retrieval-plugin | |
org.opencontainers.image.vendor=iCoreTech, Inc. | |
tags: | | |
type=raw,value=${{ env.VERSION }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
if: ${{ steps.tag.outputs.skipped != 'true' }} | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.PACKAGES_PAT }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
if: ${{ steps.tag.outputs.skipped != 'true' }} | |
with: | |
context: chatgpt-retrieval-plugin | |
platforms: linux/amd64 | |
# platforms: linux/amd64,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
provenance: false |