Skip to content

Commit

Permalink
[#21] Use docker/metadata-action Github Action to customize docker ta…
Browse files Browse the repository at this point in the history
…gs based on the current branch
  • Loading branch information
xserrat committed Jan 3, 2023
1 parent 2c88aa3 commit a3db198
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions .github/workflows/build-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,37 @@ 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/[email protected]
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/[email protected]
# with:
# pattern: '#'
# string: ${{ github.ref_name }}
# replace-with: '_'
-
name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: xserrat/facebook-demucs:${{ steps.github_ref_name_replacement_step.outputs.replaced }}
tags: ${{ steps.meta.outputs.tags }}
# tags: xserrat/facebook-demucs:${{ steps.github_ref_name_replacement_step.outputs.replaced }}

0 comments on commit a3db198

Please sign in to comment.