From c34cfe59ad4777eb806227b3c5ee1179c8b71309 Mon Sep 17 00:00:00 2001 From: Julien Bouquillon Date: Fri, 13 Dec 2024 12:43:46 +0100 Subject: [PATCH] fix: docker workflow --- .github/workflows/docker.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..b2b3662 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,31 @@ +name: 📦 Docker Image Build & Push + +on: + push: + branches: + - "**" + +jobs: + docker: + runs-on: ubuntu-latest + name: Build and push Docker image + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Inject enhanced GitHub environment variables + uses: rlespinasse/github-slug-action@v5 + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ github.token }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + push: true + tags: | + ghcr.io/${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}/albert-docs:${{ env.GITHUB_REF_SLUG }} + ${{ github.ref_name == 'main' && format('ghcr.io/{0}/albert-docs:latest', env.GITHUB_REPOSITORY_OWNER_PART_SLUG) || '' }} + cache-from: type=registry,ref=ghcr.io/${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}/albert-docs:${{ env.GITHUB_REF_SLUG }} + cache-to: type=inline