From 88be1307190c5f798df60e525635c8779c18c50d Mon Sep 17 00:00:00 2001 From: Zakary Timson Date: Fri, 28 Jul 2023 13:23:26 +0000 Subject: [PATCH] Update .github/workflows/docker-publish.yaml --- .github/workflows/docker-publish.yaml | 70 +++++++++++++-------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/.github/workflows/docker-publish.yaml b/.github/workflows/docker-publish.yaml index f864264..20757bb 100644 --- a/.github/workflows/docker-publish.yaml +++ b/.github/workflows/docker-publish.yaml @@ -1,42 +1,42 @@ name: Build & push docker image inputs: - registry: - required: false - type: string - image: - required: true - type: string - tag: - required: false - type: string + registry: + required: false + type: string + image: + required: true + type: string + tag: + required: false + type: string secrets: - registry_user: - required: true - type: string - registry_pass: - required: true - type: string + registry_user: + required: true + type: string + registry_pass: + required: true + type: string jobs: - Build: - runs-on: Docker - container: - image: docker - steps: + Build: + runs-on: Docker + container: + image: docker + steps: + + - name: Login to registry + run: | + REGISTRY=$([ "${{inputs.registry}}" -n ] && echo "${{inputs.registry}}" || echo "${{github.server.url}}") + echo "${{secrets.registry_pass}}" | docker login -u "${{secrets.registry_user}}" --password-stdin "$REGISTRY" + + - uses: actions/checkout@v3 + + - name: Create tag + run: TAG=$([ "${{inputs.tag}}" -n ] && echo "${{inputs.tag}}" || [ "${{github.ref}}" == "refs/heads/develop" ] && echo "latest" || echo "${{github.ref.name}}" | sed -E "s/[_/]/-/g") + + - name: Build image + run: docker build --no-cache -t "${{inputs.image}}:$TAG" . - - name: Login to registry - run:| - REGISTRY=$([ "${{inputs.registry}}" -n ] && echo "${{inputs.registry}}" || echo "${{github.server.url}}") - echo "${{secrets.registry_pass}}" | docker login -u "${{secrets.registry_user}}" --password-stdin "$REGISTRY" - - - uses: actions/checkout@v3 - - - name: Create tag - run: TAG=$([ "${{inputs.tag}}" -n ] && echo "${{inputs.tag}}" || [ "${{github.ref}}" == "refs/heads/develop" ] && echo "latest" || echo "${{github.ref.name}}" | sed -E "s/[_/]/-/g") - - - name: Build image - run: docker build --no-cache -t "${{inputs.image}}:$TAG" . - - - name: Push image - run: docker push "${{inputs.image}}:$TAG" + - name: Push image + run: docker push "${{inputs.image}}:$TAG"