Skip to content

Commit

Permalink
Update workflow to use MY_GITHUB_TOKEN and incorporate original workf…
Browse files Browse the repository at this point in the history
…low techniques
  • Loading branch information
oznav2 committed Sep 15, 2024
1 parent 15bda5f commit 792e09c
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:

env:
REGISTRY: ghcr.io
IMAGE_NAME: oznav2/ilan-open-webui

jobs:
build-and-push:
Expand All @@ -20,25 +19,20 @@ 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

- 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:
Expand All @@ -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}}
Expand All @@ -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 }}
Expand Down

0 comments on commit 792e09c

Please sign in to comment.