From d8ef96c3513fde582c35e526bed6ccc09aaadb6a Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Thu, 11 Aug 2022 00:00:19 +0200 Subject: [PATCH] rework the images --- .github/workflows/docker-image.yml | 7 +++--- .github/workflows/pypi_on_release.yml | 36 ++++++++++++++------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 7973eac72d..61b5fecf97 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -42,7 +42,6 @@ jobs: context: . push: true tags: | - ${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}:latest ${{ steps.metalocal.outputs.tags }} labels: ${{ steps.metalocal.outputs.labels }} @@ -76,12 +75,12 @@ jobs: context: . push: true tags: | - ${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}:latest + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest ${{ steps.metalocal.outputs.tags }} ${{ steps.meta.outputs.tags }} labels: ${{ steps.metalocal.outputs.labels }} - cache-from: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache - cache-to: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache + cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max playwright: runs-on: [self-hosted, new] needs: [build] diff --git a/.github/workflows/pypi_on_release.yml b/.github/workflows/pypi_on_release.yml index dfd62d0d4a..20adbfc8b1 100644 --- a/.github/workflows/pypi_on_release.yml +++ b/.github/workflows/pypi_on_release.yml @@ -1,12 +1,13 @@ env: - LOCAL_REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }}-lsp name: Publish python-client on: push: tags: - "v*" + workflow_dispatch: jobs: publish_pypi: @@ -32,32 +33,33 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - - name: Login to registry - if: github.event_name != 'pull_request' - uses: docker/login-action@v2 - with: - registry: ${{ env.LOCAL_REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Docker meta local - id: metalocal + - name: Docker meta + id: meta uses: docker/metadata-action@v4 with: - images: ${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-lsp + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | type=ref,event=branch + type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} + - name: Login to registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Build and push publicly uses: docker/build-push-action@v3 - if: github.event_name != 'pull_request' with: context: "{{defaultContext}}:lsp" push: true tags: | - ${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-lsp:latest + ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + ${{ steps.metalocal.outputs.tags }} + ${{ steps.meta.outputs.tags }} labels: ${{ steps.metalocal.outputs.labels }} - cache-from: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-lsp:buildcache - cache-to: type=registry,ref=${{ env.LOCAL_REGISTRY }}/${{ env.IMAGE_NAME }}-lsp:buildcache,mode=max + cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache + cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max