mirror of
https://github.com/ko-build/ko.git
synced 2026-06-18 20:14:08 +02:00
* ci: build and test using 1.18 and 1.19 (drop 1.17) * remove pre-1.18 compat code, update README * go install goimports before checkout * update chainguard-dev/actions to versions that go install
39 lines
1.1 KiB
YAML
39 lines
1.1 KiB
YAML
name: image
|
|
|
|
on:
|
|
push:
|
|
branches: ['main']
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
id-token: write
|
|
|
|
jobs:
|
|
image:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.18
|
|
check-latest: true
|
|
- uses: sigstore/cosign-installer@v2.5.1
|
|
|
|
# Build ko from HEAD, build and push an image tagged with the commit SHA,
|
|
# then keylessly sign it with cosign.
|
|
- name: Publish and sign image
|
|
env:
|
|
KO_DOCKER_REPO: ghcr.io/${{ github.repository }}
|
|
COSIGN_EXPERIMENTAL: 'true'
|
|
run: |
|
|
go build ./
|
|
echo "${{ github.token }}" | ./ko login ghcr.io --username "${{ github.actor }}" --password-stdin
|
|
img=$(./ko build --bare --platform=all -t latest -t ${{ github.sha }} ./)
|
|
echo "built ${img}"
|
|
cosign sign ${img} \
|
|
-a sha=${{ github.sha }} \
|
|
-a run_id=${{ github.run_id }} \
|
|
-a run_attempt=${{ github.run_attempt }}
|