Prevent publishing alpha/beta releases as latest on DockerHub

pull/461/head
Amir Zarrinkafsh 2019-11-22 13:02:06 +11:00 committed by Clément Michaud
parent 02971ff52c
commit 1530267b50
1 changed files with 5 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import (
"errors" "errors"
"fmt" "fmt"
"os" "os"
"regexp"
"strings" "strings"
"github.com/clems4ever/authelia/internal/utils" "github.com/clems4ever/authelia/internal/utils"
@ -198,6 +199,7 @@ func publishDockerManifest() {
travisBranch := os.Getenv("TRAVIS_BRANCH") travisBranch := os.Getenv("TRAVIS_BRANCH")
travisPullRequest := os.Getenv("TRAVIS_PULL_REQUEST") travisPullRequest := os.Getenv("TRAVIS_PULL_REQUEST")
travisTag := os.Getenv("TRAVIS_TAG") travisTag := os.Getenv("TRAVIS_TAG")
ignoredSuffixes := regexp.MustCompile("alpha|beta")
if travisBranch == "master" && travisPullRequest == "false" { if travisBranch == "master" && travisPullRequest == "false" {
login(docker) login(docker)
@ -205,7 +207,9 @@ func publishDockerManifest() {
} else if travisTag != "" { } else if travisTag != "" {
login(docker) login(docker)
deployManifest(docker, travisTag, travisTag+"-amd64", travisTag+"-arm32v7", travisTag+"-arm64v8") deployManifest(docker, travisTag, travisTag+"-amd64", travisTag+"-arm32v7", travisTag+"-arm64v8")
if !ignoredSuffixes.MatchString(travisTag) {
deployManifest(docker, "latest", "latest-amd64", "latest-arm32v7", "latest-arm64v8") deployManifest(docker, "latest", "latest-amd64", "latest-arm32v7", "latest-arm64v8")
}
} else { } else {
fmt.Println("Docker manifest will not be published") fmt.Println("Docker manifest will not be published")
} }