From 2e526b75705c02902ab3876af66f5af8e0fcca86 Mon Sep 17 00:00:00 2001 From: "maksim.nabokikh" Date: Mon, 3 Mar 2025 22:06:02 +0100 Subject: [PATCH] Make workflow prettier Signed-off-by: maksim.nabokikh --- .github/workflows/publish-tag.yaml | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/publish-tag.yaml b/.github/workflows/publish-tag.yaml index de2a25d..dee10ef 100644 --- a/.github/workflows/publish-tag.yaml +++ b/.github/workflows/publish-tag.yaml @@ -11,6 +11,7 @@ on: env: WERF_STAGED_DOCKERFILE_VERSION: v2 + WERF_BUILDAH_MODE: auto jobs: build: @@ -23,37 +24,28 @@ jobs: with: fetch-depth: 0 - - name: Get the version - id: get_version - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - - uses: werf/actions/install@v1.2 - name: Login into ghcr.io shell: bash run: werf cr login -u ${{ github.actor }} -p ${{ github.token }} ghcr.io/${{ github.repository }} - # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - name: Extract Docker metadata uses: docker/metadata-action@v5.6.1 with: images: ghcr.io/${{ github.repository }}/${{ matrix.name }} - # Build and push Docker image with Buildx (don't push on PR) - # https://github.com/docker/build-push-action - - name: Build Image - if: ${{ github.event_name == 'pull_request' }} + - name: Export werf variables run: | source "$(werf ci-env github --as-file)" source <(jq -r '.labels | to_entries | to_entries[] | "export WERF_EXPORT_ADD_LABEL_\(.key)=\"\(.value.key)=\(.value.value)\""' <<< $DOCKER_METADATA_OUTPUT_JSON) + + - name: Build Image + if: ${{ github.event_name == 'pull_request' }} + run: | werf build - # with: - # push: ${{ github.event_name == 'pull_request' }} - # tags: ${{ steps.meta.outputs.tags }} - # labels: ${{ steps.meta.outputs.labels }} - # build-args: | - # TAG=${{ github.ref_name }} - # platforms: linux/amd64,linux/arm64,linux/arm - # file: ./Dockerfile.${{ matrix.name }} + - name: Build and Push Image + if: ${{ github.event_name != 'pull_request' }} + run: | + werf export --tag ghcr.io/${{ github.repository }}/%image%:${{ github.ref_name }}