Skip to content

Commit

Permalink
Add a workflow to push a :latest ko image to ghcr.io (ko-build#528)
Browse files Browse the repository at this point in the history
* Add a workflow to push a :latest ko image to ghcr.io

This also tags images with the commit SHA

* Update .github/workflows/image.yaml

Co-authored-by: jonjohnsonjr <jonjohnson@google.com>

* Update .github/workflows/image.yaml

Co-authored-by: jonjohnsonjr <jonjohnson@google.com>

* Update .github/workflows/image.yaml

Co-authored-by: jonjohnsonjr <jonjohnson@google.com>

Co-authored-by: jonjohnsonjr <jonjohnson@google.com>
  • Loading branch information
imjasonh and jonjohnsonjr authored Dec 9, 2021
1 parent ad0607f commit a8c0773
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
@@ -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, set up 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 "${{ github.actor }}" --password-stdin
./ko build --bare --platform=all -t latest -t ${{ github.sha }} .

0 comments on commit a8c0773

Please sign in to comment.