-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#21] Use docker/metadata-action Github Action to customize docker ta…
…gs based on the current branch
- Loading branch information
Showing
1 changed file
with
22 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,25 +20,38 @@ 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: | | ||
# set branch as tag name | ||
type=ref,event=push,value={{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 }} |