Make workflow prettier

Signed-off-by: maksim.nabokikh <max.nabokih@gmail.com>
This commit is contained in:
maksim.nabokikh 2025-03-03 22:06:02 +01:00
parent 38ed4afcb4
commit 2e526b7570

View File

@ -11,6 +11,7 @@ on:
env: env:
WERF_STAGED_DOCKERFILE_VERSION: v2 WERF_STAGED_DOCKERFILE_VERSION: v2
WERF_BUILDAH_MODE: auto
jobs: jobs:
build: build:
@ -23,37 +24,28 @@ jobs:
with: with:
fetch-depth: 0 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 - uses: werf/actions/install@v1.2
- name: Login into ghcr.io - name: Login into ghcr.io
shell: bash shell: bash
run: werf cr login -u ${{ github.actor }} -p ${{ github.token }} ghcr.io/${{ github.repository }} 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 - name: Extract Docker metadata
uses: docker/metadata-action@v5.6.1 uses: docker/metadata-action@v5.6.1
with: with:
images: ghcr.io/${{ github.repository }}/${{ matrix.name }} images: ghcr.io/${{ github.repository }}/${{ matrix.name }}
# Build and push Docker image with Buildx (don't push on PR) - name: Export werf variables
# https://github.com/docker/build-push-action
- name: Build Image
if: ${{ github.event_name == 'pull_request' }}
run: | run: |
source "$(werf ci-env github --as-file)" 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) 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 werf build
# with: - name: Build and Push Image
# push: ${{ github.event_name == 'pull_request' }} if: ${{ github.event_name != 'pull_request' }}
# tags: ${{ steps.meta.outputs.tags }} run: |
# labels: ${{ steps.meta.outputs.labels }} werf export --tag ghcr.io/${{ github.repository }}/%image%:${{ github.ref_name }}
# build-args: |
# TAG=${{ github.ref_name }}
# platforms: linux/amd64,linux/arm64,linux/arm
# file: ./Dockerfile.${{ matrix.name }}