From 1706e0ed867f01bccd99b431fdddc127f519ae37 Mon Sep 17 00:00:00 2001 From: Toan Nguyen Date: Wed, 25 Sep 2024 01:08:55 +0700 Subject: [PATCH] ci: fix release pipeline (#8) --- .github/workflows/release.yaml | 70 +++++++++++++++++----------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 714760d..f0ac0a6 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,16 +12,49 @@ jobs: tests: uses: ./.github/workflows/test.yaml + release-image: + name: Release ndc-prometheus image + runs-on: ubuntu-latest + needs: [tests] + steps: + - uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + 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 }} + + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + tags: ${{ steps.docker-metadata.outputs.tags }} + labels: ${{ steps.docker-metadata.outputs.labels }} + build-cli-binaries: name: build the CLI binaries runs-on: ubuntu-latest - needs: [tests] + needs: [release-image] steps: - name: Checkout uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" - name: build the CLI run: | VERSION="$GITHUB_REF_NAME" make ci-build-configuration @@ -41,45 +74,12 @@ jobs: if-no-files-found: error name: artifact - release-image: - name: Release ndc-prometheus image - runs-on: ubuntu-latest - needs: [build-cli-binaries] - steps: - - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - registry: ${{ env.DOCKER_REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Get version from tag id: get-version run: | echo "tagged_version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT shell: bash - - name: Extract metadata (tags, labels) for Docker - id: docker-metadata - uses: docker/metadata-action@v5 - with: - images: ${{ env.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }} - - - name: Build and push - uses: docker/build-push-action@v6 - with: - push: true - tags: ${{ steps.docker-metadata.outputs.tags }} - labels: ${{ steps.docker-metadata.outputs.labels }} - - name: Build connector definition run: | ./scripts/build-manifest.sh