From 792e09c020111c7eca3bb57f213eec7188f1484d Mon Sep 17 00:00:00 2001 From: oznav2 Date: Sun, 15 Sep 2024 16:04:47 +0300 Subject: [PATCH] Update workflow to use MY_GITHUB_TOKEN and incorporate original workflow techniques --- .github/workflows/docker-build-push.yml | 26 +++++++++++-------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index d8aac14701..8ae0277ad3 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -8,7 +8,6 @@ on: env: REGISTRY: ghcr.io - IMAGE_NAME: oznav2/ilan-open-webui jobs: build-and-push: @@ -20,8 +19,13 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - fetch-depth: 0 + + - name: Set repository and image name to lowercase + run: | + echo "IMAGE_NAME=${IMAGE_NAME,,}" >> ${GITHUB_ENV} + echo "FULL_IMAGE_NAME=${REGISTRY}/${IMAGE_NAME,,}" >> ${GITHUB_ENV} + env: + IMAGE_NAME: '${{ github.repository }}' - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -29,16 +33,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - - name: Check GitHub Container Registry authentication - run: | - echo ${{ secrets.MY_GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin - if [ $? -eq 0 ]; then - echo "Successfully authenticated with ghcr.io" - else - echo "Failed to authenticate with ghcr.io" - exit 1 - fi - - name: Log in to the Container registry uses: docker/login-action@v3 with: @@ -50,10 +44,10 @@ jobs: id: meta uses: docker/metadata-action@v5 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + images: ${{ env.FULL_IMAGE_NAME }} tags: | type=ref,event=branch - type=sha + type=sha,prefix=git- type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} @@ -67,6 +61,8 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max + build-args: | + BUILD_HASH=${{ github.sha }} - name: Image digest run: echo ${{ steps.docker_build.outputs.digest }}