diff --git a/.github/workflows/ndc-python-lambda-connector.yaml b/.github/workflows/ndc-python-lambda-connector.yaml index d1f77ea..b9261f6 100644 --- a/.github/workflows/ndc-python-lambda-connector.yaml +++ b/.github/workflows/ndc-python-lambda-connector.yaml @@ -36,53 +36,47 @@ jobs: echo "pytest not found, skipping tests" fi - docker: - name: Build base docker image + build-and-push-docker: + name: Build and push Docker image runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: docker/login-action@v3 + - uses: actions/setup-python@v4 + with: + python-version: '3.9' + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 with: registry: ${{ env.DOCKER_REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract metadata (tags, labels) for Docker - id: docker-metadata - uses: docker/metadata-action@v5 - with: - images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }} - - uses: docker/build-push-action@v5 - with: - context: . - push: ${{ startsWith(github.ref, 'refs/tags/v') }} - tags: ${{ steps.docker-metadata.outputs.tags }} - labels: ${{ steps.docker-metadata.outputs.labels }} + - name: Build with Makefile + run: make build + - name: Push Docker image + if: startsWith(github.ref, 'refs/tags/v') + run: | + docker push ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:${GITHUB_REF#refs/tags/} + docker push ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:latest release-connector: name: Release connector runs-on: ubuntu-latest needs: - build-and-test - - docker - if: ${{ startsWith(github.ref, 'refs/tags/v') }} + - build-and-push-docker + if: startsWith(github.ref, 'refs/tags/v') steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 with: python-version: '3.9' - name: Build connector definition - run: | - if [ -f Makefile ]; then - make build - else - echo "Makefile not found, skipping build" - fi + run: make build - uses: actions/upload-artifact@v4 with: name: connector-definition.tgz path: ./dist/connector-definition.tgz compression-level: 0 # Already compressed - if: ${{ success() }} - name: Get version from tag id: get-version run: |