From 89875ed4ebdb5d9529cd6b0cebbb260fbbf5643f Mon Sep 17 00:00:00 2001 From: Hartmut Obendorf Date: Wed, 4 Aug 2021 10:03:38 +0200 Subject: [PATCH 1/7] Fixed error when pushing to ghcr.io for organizations containing uppercase letters added conversion to lower case for the repository string Pushed golang to 1.16 --- .github/workflows/main.yml | 4 ++-- Dockerfile | 2 +- go.mod | 2 +- helper.go | 2 +- helper_test.go | 14 ++++++++++++++ 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e4c2747..9c12048 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,10 +10,10 @@ jobs: - name: Checkout uses: actions/checkout@v1 - - name: Set up Go 1.13 + - name: Set up Go 1.16 uses: actions/setup-go@v1 with: - go-version: 1.13 + go-version: 1.16 - name: Download dependencies run: go mod vendor diff --git a/Dockerfile b/Dockerfile index 59d2ba3..6484a31 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.13-alpine as builder +FROM golang:1.16-alpine as builder WORKDIR /src COPY . /src diff --git a/go.mod b/go.mod index b32a5a1..cded416 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ module github.com/jerray/publish-docker-action -go 1.13 +go 1.16 require github.com/caarlos0/env/v6 v6.0.0 diff --git a/helper.go b/helper.go index 0d332b8..0ace6a5 100644 --- a/helper.go +++ b/helper.go @@ -14,7 +14,7 @@ const ( func resolveInputs(github GitHub, inputs *Inputs) error { if inputs.Repository == "" { - inputs.Repository = github.Repository + inputs.Repository = strings.ToLower(github.Repository) } if inputs.Registry != "" && !strings.HasPrefix(inputs.Repository, inputs.Registry) { diff --git a/helper_test.go b/helper_test.go index f7cc31d..f8e1636 100644 --- a/helper_test.go +++ b/helper_test.go @@ -83,6 +83,20 @@ func Test_resolveInputs(t *testing.T) { tags: []string{}, repository: "username/repo", }, + { + github: GitHub{ + Repository: "Organization/username/repo", + Commit: "45ba489c4f97b5f854ebaba6454b51fa", + Ref: "refs/pull/master", + }, + inputs: &Inputs{ + Tags: []string{}, + AllowPullRequest: false, + }, + hasError: true, + tags: []string{}, + repository: "organization/username/repo", + }, } for _, c := range cases { err := resolveInputs(c.github, c.inputs) From 9f5ff55d238a7330fb7f7bca21734b96ed02fdad Mon Sep 17 00:00:00 2001 From: Hartmut Obendorf Date: Wed, 4 Aug 2021 11:09:27 +0200 Subject: [PATCH 2/7] Change converting to lower case Moved convert call from repository input to tags --- helper.go | 4 ++-- helper_test.go | 14 -------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/helper.go b/helper.go index 0ace6a5..5a6eeb6 100644 --- a/helper.go +++ b/helper.go @@ -14,7 +14,7 @@ const ( func resolveInputs(github GitHub, inputs *Inputs) error { if inputs.Repository == "" { - inputs.Repository = strings.ToLower(github.Repository) + inputs.Repository = github.Repository } if inputs.Registry != "" && !strings.HasPrefix(inputs.Repository, inputs.Registry) { @@ -30,7 +30,7 @@ func resolveInputs(github GitHub, inputs *Inputs) error { resolveAutoTag(typ, name, inputs) for i, t := range inputs.Tags { - inputs.Tags[i] = strings.Join([]string{inputs.Repository, t}, ":") + inputs.Tags[i] = strings.Join([]string{strings.ToLower(inputs.Repository), t}, ":") } return nil diff --git a/helper_test.go b/helper_test.go index f8e1636..f7cc31d 100644 --- a/helper_test.go +++ b/helper_test.go @@ -83,20 +83,6 @@ func Test_resolveInputs(t *testing.T) { tags: []string{}, repository: "username/repo", }, - { - github: GitHub{ - Repository: "Organization/username/repo", - Commit: "45ba489c4f97b5f854ebaba6454b51fa", - Ref: "refs/pull/master", - }, - inputs: &Inputs{ - Tags: []string{}, - AllowPullRequest: false, - }, - hasError: true, - tags: []string{}, - repository: "organization/username/repo", - }, } for _, c := range cases { err := resolveInputs(c.github, c.inputs) From 6abca7194eb8f20724ed5aa09a07b14927f1cb43 Mon Sep 17 00:00:00 2001 From: Hartmut Obendorf Date: Wed, 4 Aug 2021 11:29:02 +0200 Subject: [PATCH 3/7] Changed ownership of project --- .github/workflows/main.yml | 2 +- README.md | 2 ++ action.yml | 4 ++-- go.mod | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9c12048..f2e836d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,7 +27,7 @@ jobs: run: bash <(curl -s https://codecov.io/bash) -f coverage.out - name: Publish - uses: jerray/publish-docker-action@v1.0.0 + uses: hartmutobendorf/publish-docker-action@v1.0.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} diff --git a/README.md b/README.md index 676c4b6..2e05f73 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Publish Docker Action +Based on https://github.com/jerray/publish-docker-action, this fixes the problem of building docker and pushing docker images. + [![GitHub Action](https://github.com/jerray/publish-docker-action/workflows/Main/badge.svg)](https://github.com/jerray/publish-docker-action/actions?workflow=Main) [![codecov](https://codecov.io/gh/jerray/publish-docker-action/branch/master/graph/badge.svg)](https://codecov.io/gh/jerray/publish-docker-action) [![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/jerray/publish-docker-action?logo=github)](https://github.com/jerray/publish-docker-action/releases) diff --git a/action.yml b/action.yml index bf683be..b1b96f1 100644 --- a/action.yml +++ b/action.yml @@ -1,6 +1,6 @@ name: 'Publish Docker Action' description: 'Build, tag and publish docker image to your docker registry' -author: 'jerray' +author: 'hartmutobendorf, jerray' inputs: username: description: 'Username used to login docker registry' @@ -48,7 +48,7 @@ outputs: description: 'Tag name produced by activating the auto_tag option' runs: using: 'docker' - image: 'docker://jerray/publish-docker-action:1.0.5' + image: 'docker://hartmutobendorf/publish-docker-action:1.0.0' branding: icon: 'anchor' color: 'blue' diff --git a/go.mod b/go.mod index cded416..35ea998 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/jerray/publish-docker-action +module github.com/Chainstep/publish-docker-action go 1.16 From 433427ad97305fc458757850e52f76e5137f01df Mon Sep 17 00:00:00 2001 From: Hartmut Obendorf Date: Wed, 4 Aug 2021 11:33:58 +0200 Subject: [PATCH 4/7] Added reference to fixed PR --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2e05f73..f6ef3a9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Publish Docker Action -Based on https://github.com/jerray/publish-docker-action, this fixes the problem of building docker and pushing docker images. +Based on https://github.com/jerray/publish-docker-action, this fixes the problem of building docker and pushing docker images, documented in https://github.com/jerray/publish-docker-action/pull/18. [![GitHub Action](https://github.com/jerray/publish-docker-action/workflows/Main/badge.svg)](https://github.com/jerray/publish-docker-action/actions?workflow=Main) [![codecov](https://codecov.io/gh/jerray/publish-docker-action/branch/master/graph/badge.svg)](https://codecov.io/gh/jerray/publish-docker-action) From 23b50d245fcf6db7f1902ebc3f770fb389370d37 Mon Sep 17 00:00:00 2001 From: Hartmut Obendorf Date: Wed, 4 Aug 2021 11:47:38 +0200 Subject: [PATCH 5/7] updated README --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index f6ef3a9..2eb3a7c 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ tag and push to docker default registry (docker.io). Repository name is your Git name by default. ```yaml -- uses: jerray/publish-docker-action@master +- uses: hartmutobendorf/publish-docker-action@main with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} @@ -30,12 +30,12 @@ You can set docker registry with `registry` argument. Change docker repository n For example: ```yaml -- uses: jerray/publish-docker-action@master +- uses: hartmutobendorf/publish-docker-action@main with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} registry: docker.pkg.github.com - repository: jerray/publish-docker-action + repository: Chainstep/publish-docker-action ``` This will build and push the tag `docker.pkg.github.com/jerray/publish-docker-action:latest`. @@ -47,12 +47,12 @@ This will build and push the tag `docker.pkg.github.com/jerray/publish-docker-ac You can use static tag list by providing `tags` argument. Concat multiple tag names with commas. ```yaml -- uses: jerray/publish-docker-action@master +- uses: hartmutobendorf/publish-docker-action@main with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} registry: docker.pkg.github.com - repository: jerray/publish-docker-action + repository: Chainstep/publish-docker-action tags: latest,newest,master ``` @@ -67,12 +67,12 @@ This example builds the image, creates three tags, and pushes all of them to the Set `with.auto_tag: true` to allow action generate docker image tags automatically. ```yaml -- uses: jerray/publish-docker-action@master +- uses: hartmutobendorf/publish-docker-action@main with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} registry: docker.pkg.github.com - repository: jerray/publish-docker-action + repository: Chainstep/publish-docker-action auto_tag: true ``` @@ -100,12 +100,12 @@ Additionally, there's an output value `tag` you can use [in your next steps](htt ```yaml - id: build - uses: jerray/publish-docker-action@master + uses: hartmutobendorf/publish-docker-action@main with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} registry: docker.pkg.github.com - repository: jerray/publish-docker-action + repository: Chainstep/publish-docker-action auto_tag: true - id: deploy @@ -124,12 +124,12 @@ Provide `with.cache` argument to build from cache. Use `with.build_args` to provide docker build-time variables. Multiple variables must be separated by comma. ```yaml -- uses: jerray/publish-docker-action@master +- uses: hartmutobendorf/publish-docker-action@main with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} registry: docker.pkg.github.com - repository: jerray/publish-docker-action + repository: Chainstep/publish-docker-action build_args: HTTP_PROXY=http://127.0.0.1,USER=nginx ``` From 3be8044c153b9d0e1753d89e8fc2777939f402aa Mon Sep 17 00:00:00 2001 From: Hartmut Obendorf Date: Wed, 4 Aug 2021 11:48:18 +0200 Subject: [PATCH 6/7] updated README --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2eb3a7c..93fd788 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ tag and push to docker default registry (docker.io). Repository name is your Git name by default. ```yaml -- uses: hartmutobendorf/publish-docker-action@main +- uses: hartmutobendorf/publish-docker-action@master with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} @@ -30,7 +30,7 @@ You can set docker registry with `registry` argument. Change docker repository n For example: ```yaml -- uses: hartmutobendorf/publish-docker-action@main +- uses: hartmutobendorf/publish-docker-action@master with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} @@ -47,7 +47,7 @@ This will build and push the tag `docker.pkg.github.com/jerray/publish-docker-ac You can use static tag list by providing `tags` argument. Concat multiple tag names with commas. ```yaml -- uses: hartmutobendorf/publish-docker-action@main +- uses: hartmutobendorf/publish-docker-action@master with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} @@ -67,7 +67,7 @@ This example builds the image, creates three tags, and pushes all of them to the Set `with.auto_tag: true` to allow action generate docker image tags automatically. ```yaml -- uses: hartmutobendorf/publish-docker-action@main +- uses: hartmutobendorf/publish-docker-action@master with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} @@ -100,7 +100,7 @@ Additionally, there's an output value `tag` you can use [in your next steps](htt ```yaml - id: build - uses: hartmutobendorf/publish-docker-action@main + uses: hartmutobendorf/publish-docker-action@master with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} @@ -124,7 +124,7 @@ Provide `with.cache` argument to build from cache. Use `with.build_args` to provide docker build-time variables. Multiple variables must be separated by comma. ```yaml -- uses: hartmutobendorf/publish-docker-action@main +- uses: hartmutobendorf/publish-docker-action@master with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} From 09ea6253a2a88616dc7452b694eef38a9bd3d304 Mon Sep 17 00:00:00 2001 From: Hartmut Obendorf Date: Fri, 6 Aug 2021 09:33:12 +0200 Subject: [PATCH 7/7] corrected reference to version --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f2e836d..77b1261 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,7 +27,7 @@ jobs: run: bash <(curl -s https://codecov.io/bash) -f coverage.out - name: Publish - uses: hartmutobendorf/publish-docker-action@v1.0.0 + uses: hartmutobendorf/publish-docker-action@v0.0.1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }}