From 0412fbf4baeceab5079e65a87769b81b6ce8bb6d Mon Sep 17 00:00:00 2001 From: lenkan Date: Thu, 29 Feb 2024 12:30:30 +0100 Subject: [PATCH] feat: possibility to push docker image for other org --- .github/workflows/publish-keria.yml | 60 ++++++++++------------------- 1 file changed, 20 insertions(+), 40 deletions(-) diff --git a/.github/workflows/publish-keria.yml b/.github/workflows/publish-keria.yml index 62f0f7bf..de5803fe 100644 --- a/.github/workflows/publish-keria.yml +++ b/.github/workflows/publish-keria.yml @@ -1,57 +1,37 @@ - name: Publish Docker image on: + push: + branches: ["main", "development"] workflow_dispatch: - inputs: - version: - required: true + +env: + IMAGE_NAME: ${{ github.repository }} + jobs: - push_to_registry: - name: Push Docker image to Docker Hub + build-and-push-image: runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - - name: Check out the repo + - name: Checkout repository uses: actions/checkout@v4 - - - name: Log in to Docker Hub - uses: docker/login-action@v2 + - name: Log in to the Container registry + uses: docker/login-action@v3 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: - images: WebOfTrust/keria - - - name: Set up Docker buildx - id: buildx - uses: docker/setup-buildx-action@v3 - - - name: Cache Docker Layers - uses: actions/cache@v3 - with: - path: /tmp/.buildx-cache - key: keri-${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - keri-${{ runner.os }}-buildx- - + images: ${{ env.IMAGE_NAME }} - name: Build and push Docker image - uses: docker/build-push-action@v3 + uses: docker/build-push-action@v5 with: context: . file: images/keria.dockerfile push: true - tags: | - WebOfTrust/keria:${{ github.event.inputs.version }} - WebOfTrust/keria:latest - labels: ${{ github.event.inputs.version }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max - - - name: Move Docker cache - run: | - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache \ No newline at end of file + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}