From a3db198de3c0dc25a8f219a6d972a444b4ba31d0 Mon Sep 17 00:00:00 2001 From: Xavier Serrat Bordas Date: Wed, 4 Jan 2023 00:59:53 +0100 Subject: [PATCH] [#21] Use docker/metadata-action Github Action to customize docker tags based on the current branch --- .github/workflows/build-image.yaml | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-image.yaml b/.github/workflows/build-image.yaml index a7ba628..57f3637 100644 --- a/.github/workflows/build-image.yaml +++ b/.github/workflows/build-image.yaml @@ -20,20 +20,31 @@ jobs: uses: docker/setup-buildx-action@v2 with: platforms: linux/amd64,linux/arm64 + - + name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + xserrat/facebook-demucs + tags: | + type=raw,value={{branch}},enable={{!is_default_branch}} + # set latest tag for default branch + type=raw,value=latest,enable={{is_default_branch}} - name: Login to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Replace char '#' to '_' from GITHUB_REF_NAME env variable - id: github_ref_name_replacement_step - uses: frabert/replace-string-action@v2.0 - with: - pattern: '#' - string: ${{ github.ref_name }} - replace-with: '_' +# - +# name: Replace char '#' to '_' from GITHUB_REF_NAME env variable +# id: github_ref_name_replacement_step +# uses: frabert/replace-string-action@v2.0 +# with: +# pattern: '#' +# string: ${{ github.ref_name }} +# replace-with: '_' - name: Build and push uses: docker/build-push-action@v3 @@ -41,4 +52,5 @@ jobs: context: . push: true platforms: linux/amd64,linux/arm64 - tags: xserrat/facebook-demucs:${{ steps.github_ref_name_replacement_step.outputs.replaced }} \ No newline at end of file + tags: ${{ steps.meta.outputs.tags }} +# tags: xserrat/facebook-demucs:${{ steps.github_ref_name_replacement_step.outputs.replaced }} \ No newline at end of file