|
| 1 | +name: Release Docker images |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "*" |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + |
| 12 | +jobs: |
| 13 | + docker: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Set tag |
| 19 | + run: | |
| 20 | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then |
| 21 | + git fetch --tags --force |
| 22 | + latest_tag=$(git tag --sort=version:refname | tail -n 1) |
| 23 | + if [ -z "$latest_tag" ]; then |
| 24 | + echo "No git tags found; cannot determine latest tag." |
| 25 | + exit 1 |
| 26 | + fi |
| 27 | + echo "TAG=${latest_tag}" >> "$GITHUB_ENV" |
| 28 | + else |
| 29 | + echo "TAG=${{ github.ref_name }}" >> "$GITHUB_ENV" |
| 30 | + fi |
| 31 | +
|
| 32 | + - name: Set up QEMU |
| 33 | + uses: docker/setup-qemu-action@v3 |
| 34 | + |
| 35 | + - name: Set up Docker Buildx |
| 36 | + uses: docker/setup-buildx-action@v3 |
| 37 | + |
| 38 | + - name: Login to Docker Hub |
| 39 | + uses: docker/login-action@v3 |
| 40 | + with: |
| 41 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 42 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 43 | + |
| 44 | + - name: Build and push base image |
| 45 | + uses: docker/build-push-action@v6 |
| 46 | + with: |
| 47 | + context: . |
| 48 | + file: ./scraper/dev/docker/Dockerfile.base |
| 49 | + platforms: linux/amd64,linux/arm64 |
| 50 | + push: true |
| 51 | + tags: | |
| 52 | + typesense/docsearch-scraper-base:${{ env.TAG }} |
| 53 | + typesense/docsearch-scraper-base:latest |
| 54 | +
|
| 55 | + - name: Build and push scraper image |
| 56 | + uses: docker/build-push-action@v6 |
| 57 | + with: |
| 58 | + context: . |
| 59 | + file: ./scraper/dev/docker/Dockerfile |
| 60 | + platforms: linux/amd64,linux/arm64 |
| 61 | + push: true |
| 62 | + build-args: | |
| 63 | + SCRAPER_BASE_VERSION=${{ env.TAG }} |
| 64 | + tags: | |
| 65 | + typesense/docsearch-scraper:${{ env.TAG }} |
| 66 | + typesense/docsearch-scraper:latest |
0 commit comments