|
| 1 | +name: test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '**' |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + build-and-release: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout |
| 16 | + uses: actions/checkout@v4 |
| 17 | + - name: Get git describe |
| 18 | + id: get-version |
| 19 | + run: | |
| 20 | + describe=$(git describe --tags --always --dirty) |
| 21 | + echo "GIT_COMMIT_REF_NAME=$describe" >> $GITHUB_ENV |
| 22 | + - name: Setup go |
| 23 | + uses: actions/setup-go@v5 |
| 24 | + with: |
| 25 | + go-version: '1.23' |
| 26 | + check-latest: true |
| 27 | + - run: go version |
| 28 | + - name: Run build and test |
| 29 | + run: make clean build test clean |
| 30 | + - name: Docker meta |
| 31 | + id: meta |
| 32 | + uses: docker/metadata-action@v5 |
| 33 | + with: |
| 34 | + images: | |
| 35 | + grepplabs/kafka-proxy |
| 36 | + tags: | |
| 37 | + type=ref,event=branch |
| 38 | + type=ref,event=pr |
| 39 | + type=semver,pattern={{version}} |
| 40 | + type=semver,pattern={{major}}.{{minor}} |
| 41 | + type=semver,pattern={{major}} |
| 42 | + type=sha |
| 43 | + - name: Docker meta - all |
| 44 | + id: meta-all |
| 45 | + uses: docker/metadata-action@v5 |
| 46 | + with: |
| 47 | + images: | |
| 48 | + grepplabs/kafka-proxy |
| 49 | + flavor: | |
| 50 | + suffix=-all |
| 51 | + tags: | |
| 52 | + type=ref,event=branch |
| 53 | + type=ref,event=pr |
| 54 | + type=semver,pattern={{version}} |
| 55 | + type=semver,pattern={{major}}.{{minor}} |
| 56 | + type=semver,pattern={{major}} |
| 57 | + type=sha |
| 58 | + - name: Set up QEMU |
| 59 | + uses: docker/setup-qemu-action@v3 |
| 60 | + - name: Set up Docker Buildx |
| 61 | + uses: docker/setup-buildx-action@v3 |
| 62 | + - name: Login to DockerHub |
| 63 | + uses: docker/login-action@v3 |
| 64 | + with: |
| 65 | + username: ${{ secrets.DOCKERHUB_USERNAME }} |
| 66 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 67 | + - name: Docker build and push |
| 68 | + uses: docker/build-push-action@v6 |
| 69 | + with: |
| 70 | + context: . |
| 71 | + push: true |
| 72 | + platforms: linux/amd64,linux/arm64 |
| 73 | + tags: ${{ steps.meta.outputs.tags }} |
| 74 | + labels: ${{ steps.meta.outputs.labels }} |
| 75 | + build-args: VERSION=${{ env.GIT_COMMIT_REF_NAME }} |
| 76 | + - name: Docker build and push - all |
| 77 | + uses: docker/build-push-action@v6 |
| 78 | + with: |
| 79 | + context: . |
| 80 | + push: true |
| 81 | + file: Dockerfile.all |
| 82 | + platforms: linux/amd64,linux/arm64 |
| 83 | + tags: ${{ steps.meta-all.outputs.tags }} |
| 84 | + labels: ${{ steps.meta-all.outputs.labels }} |
| 85 | + build-args: VERSION=${{ env.GIT_COMMIT_REF_NAME }} |
0 commit comments