From 489387052e43b7a090da28664e1335a672e8bfd1 Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Thu, 9 Dec 2021 12:04:46 -0500 Subject: [PATCH 1/4] Add a workflow to push a :latest ko image to ghcr.io This also tags images with the commit SHA --- .github/workflows/image.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/image.yaml diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml new file mode 100644 index 0000000000..08a7ecd2c5 --- /dev/null +++ b/.github/workflows/image.yaml @@ -0,0 +1,25 @@ +name: image + +on: + push: + branches: ['main'] + workflow_dispatch: + +jobs: + image: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-go@v1 + with: + go-version: 1.17.x + + # Build ko from HEAD, setup auth to ghcr.io, build and push an image + # tagged with the SHA. + - name: Build and publish image + env: + KO_DOCKER_REPO: ghcr.io/${{ github.repository }} + run: | + go build ./ + echo "${{ github.token }}" | ./ko login ghcr.io --username "dummy" --password-stdin + ./ko build --bare --platform=all -t latest -t ${{ github.sha }} ./ From 49f64969f4e9897fbbe47b38de3976ab31e2a9dc Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Thu, 9 Dec 2021 12:39:31 -0500 Subject: [PATCH 2/4] Update .github/workflows/image.yaml Co-authored-by: jonjohnsonjr --- .github/workflows/image.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml index 08a7ecd2c5..c753e3014e 100644 --- a/.github/workflows/image.yaml +++ b/.github/workflows/image.yaml @@ -14,7 +14,7 @@ jobs: with: go-version: 1.17.x - # Build ko from HEAD, setup auth to ghcr.io, build and push an image + # Build ko from HEAD, set up auth to ghcr.io, build and push an image # tagged with the SHA. - name: Build and publish image env: From 94b4eaa706d7783f5fd8bc4e9dc0644a051f0cf8 Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Thu, 9 Dec 2021 12:41:29 -0500 Subject: [PATCH 3/4] Update .github/workflows/image.yaml Co-authored-by: jonjohnsonjr --- .github/workflows/image.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml index c753e3014e..62271d51f1 100644 --- a/.github/workflows/image.yaml +++ b/.github/workflows/image.yaml @@ -21,5 +21,5 @@ jobs: KO_DOCKER_REPO: ghcr.io/${{ github.repository }} run: | go build ./ - echo "${{ github.token }}" | ./ko login ghcr.io --username "dummy" --password-stdin + echo "${{ github.token }}" | ./ko login ghcr.io --username "${{ github.actor }}" --password-stdin ./ko build --bare --platform=all -t latest -t ${{ github.sha }} ./ From 5d2b9922bbc2626228bbd5092d6edc6b67686363 Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Thu, 9 Dec 2021 12:41:39 -0500 Subject: [PATCH 4/4] Update .github/workflows/image.yaml Co-authored-by: jonjohnsonjr --- .github/workflows/image.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/image.yaml b/.github/workflows/image.yaml index 62271d51f1..0c02a0ca6d 100644 --- a/.github/workflows/image.yaml +++ b/.github/workflows/image.yaml @@ -22,4 +22,4 @@ jobs: run: | go build ./ echo "${{ github.token }}" | ./ko login ghcr.io --username "${{ github.actor }}" --password-stdin - ./ko build --bare --platform=all -t latest -t ${{ github.sha }} ./ + ./ko build --bare --platform=all -t latest -t ${{ github.sha }} .