Skip to content

Commit

Permalink
Merge pull request #90 from kndpio/89-oci-image-for-kndp-cli
Browse files Browse the repository at this point in the history
Build OCI image for kndp cli
  • Loading branch information
evghen1 authored Mar 26, 2024
2 parents 596987e + 09fad58 commit 898a38b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
31 changes: 25 additions & 6 deletions .github/workflows/releases.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
name: Release preaparation
name: Release builds

on:
push:
tags:
- '*'

permissions:
contents: write
packages: write

jobs:
release-linux-amd64:
name: release linux/amd64
Expand All @@ -28,4 +24,27 @@ jobs:
goarch: amd64
project_path: "./cmd/kndp"
binary_name: "kndp"
ldflags: -X "main.Version=${{ env.APP_VERSION }}"
ldflags: -X "main.Version=${{ env.APP_VERSION }}"
oci-builds:
name: build OCI images
runs-on: ubuntu-latest
env:
REGISTRY: ghcr.io/kndpio/cli
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.21.4'
- uses: actions/checkout@v4
- name: Set VERSION env
run: echo VERSION=$(echo ${GITHUB_REF} | rev | cut -d'/' -f 1 | rev ) >> ${GITHUB_ENV}
- name: Set OCI_DOMAIN env
run: echo OCI_DOMAIN=$(echo ${REGISTRY} | cut -d'/' -f 1 ) >> ${GITHUB_ENV}
- uses: ko-build/[email protected]
env:
KO_DOCKER_REPO: ${{ env.REGISTRY }}
- name: Run ko build
env:
auth_token: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "${auth_token}" | ko login ${{ env.OCI_DOMAIN }} --username ${{ github.actor }} --password-stdin
ko build ./cmd/kndp/ --tags=${{ env.VERSION }} --bare
11 changes: 11 additions & 0 deletions .ko.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
builds:
- id: kndp-cli
dir: .
main: ./cmd/kndp
flags:
- -tags
- "{{.Env.VERSION}}"
ldflags:
- -s -w
- -extldflags "-static"
- -X main.Version={{.Env.VERSION}}

0 comments on commit 898a38b

Please sign in to comment.