From 253cae66e4d63c04471c7884df80e1d3f2971381 Mon Sep 17 00:00:00 2001 From: dylan Date: Wed, 7 Aug 2024 12:56:08 -0700 Subject: [PATCH 1/3] build: add upload-images.yml which builds and uploads quote and prism example images to dockerhub --- .github/workflows/upload-images.yml | 91 +++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 .github/workflows/upload-images.yml diff --git a/.github/workflows/upload-images.yml b/.github/workflows/upload-images.yml new file mode 100644 index 0000000..7b63d37 --- /dev/null +++ b/.github/workflows/upload-images.yml @@ -0,0 +1,91 @@ +name: Build and Push Docker Images + +on: + workflow_dispatch: + +jobs: + setup: + runs-on: ubuntu-latest + outputs: + tag: ${{ steps.get-tag.outputs.tag }} + steps: + - uses: actions/checkout@v4 + name: Checkout code + + - name: Get latest Git tag + id: get-tag + run: echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT + shell: bash + + build-quote-search-preview: + needs: setup + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push quote search preview Docker image + uses: docker/build-push-action@v5 + with: + context: . + file: ./.internal/Dockerfile-quote-search-preview + platforms: linux/amd64,linux/arm64 + push: true + tags: aerospike/quote-search-example:preview + + build-quote-search: + needs: setup + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push quote search latest and tagged Docker image + uses: docker/build-push-action@v5 + with: + context: ./quote-semantic-search + file: ./quote-semantic-search/Dockerfile-quote-search + platforms: linux/amd64,linux/arm64 + push: true + tags: | + aerospike/quote-search-example:latest + aerospike/quote-search-example:${{ needs.setup.outputs.tag }} + + build-prism-search: + needs: setup + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build and push prism search latest and tagged Docker image + uses: docker/build-push-action@v5 + with: + context: ./quote-semantic-search + file: ./quote-semantic-search/Dockerfile-prism + platforms: linux/amd64,linux/arm64 + push: true + tags: | + aerospike/prism-search-example:latest + aerospike/prism-search-example:${{ needs.setup.outputs.tag }} \ No newline at end of file From 13dfa5db467cd28aab4bec0ec852ddfec8da0da7 Mon Sep 17 00:00:00 2001 From: dylan Date: Wed, 7 Aug 2024 14:09:42 -0700 Subject: [PATCH 2/3] trigger image publish on release --- .github/workflows/upload-images.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/upload-images.yml b/.github/workflows/upload-images.yml index 7b63d37..c209e14 100644 --- a/.github/workflows/upload-images.yml +++ b/.github/workflows/upload-images.yml @@ -2,6 +2,8 @@ name: Build and Push Docker Images on: workflow_dispatch: + release: + types: [published] jobs: setup: From 4df2a5889f9e4f4d271f2596f886d927c3b566b7 Mon Sep 17 00:00:00 2001 From: dylan Date: Wed, 7 Aug 2024 14:26:01 -0700 Subject: [PATCH 3/3] update to docker build and upload action v6 --- .github/workflows/upload-images.yml | 34 ++++++++++++++++++----------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/upload-images.yml b/.github/workflows/upload-images.yml index c209e14..5b41362 100644 --- a/.github/workflows/upload-images.yml +++ b/.github/workflows/upload-images.yml @@ -13,20 +13,28 @@ jobs: steps: - uses: actions/checkout@v4 name: Checkout code + with: + fetch-depth: 1 + fetch-tags: true - - name: Get latest Git tag + - name: Get release tag id: get-tag - run: echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT + run: | + if [ "${{ github.event_name }}" = "release" ]; then + echo "tag=${{ github.event.release.tag_name }}" >> $GITHUB_OUTPUT + else + echo "tag=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT + fi shell: bash - build-quote-search-preview: + build-push-quote-search-preview: needs: setup runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - name: Set up Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub uses: docker/login-action@v3 @@ -34,7 +42,7 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Build and push quote search preview Docker image - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . file: ./.internal/Dockerfile-quote-search-preview @@ -42,22 +50,22 @@ jobs: push: true tags: aerospike/quote-search-example:preview - build-quote-search: + build-push-quote-search: needs: setup runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - name: Set up Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push quote search latest and tagged Docker image - uses: docker/build-push-action@v5 + - name: Build and push quote search Docker image + uses: docker/build-push-action@v6 with: context: ./quote-semantic-search file: ./quote-semantic-search/Dockerfile-quote-search @@ -67,22 +75,22 @@ jobs: aerospike/quote-search-example:latest aerospike/quote-search-example:${{ needs.setup.outputs.tag }} - build-prism-search: + build-push-prism-search: needs: setup runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up QEMU uses: docker/setup-qemu-action@v3 - - name: Set up Buildx + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build and push prism search latest and tagged Docker image - uses: docker/build-push-action@v5 + - name: Build and push prism search Docker image + uses: docker/build-push-action@v6 with: context: ./quote-semantic-search file: ./quote-semantic-search/Dockerfile-prism