diff --git a/.github/workflows/build-sdk-tests.yml b/.github/workflows/build-sdk-tests.yml new file mode 100644 index 000000000..4ee2ccdc1 --- /dev/null +++ b/.github/workflows/build-sdk-tests.yml @@ -0,0 +1,53 @@ +name: Build and Push Test Binary Docker Image + +on: + push: + pull_request: + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository_owner }}/sdk-tests + +jobs: + build-and-push: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.21' + + - name: Log in to Container Registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=raw,value=latest,enable={{is_default_branch}} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + context: ./sdk/tests + file: ./sdk/tests/Dockerfile + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}