Skip to content

Commit

Permalink
workflow OCI builds
Browse files Browse the repository at this point in the history
  • Loading branch information
evghen1 committed Mar 26, 2024
1 parent 596987e commit 2f1533b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/releases.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release preaparation
name: Release builds

on:
push:
Expand Down Expand Up @@ -28,4 +28,24 @@ 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
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.21.4'
- uses: actions/checkout@v4
- name: Set APP_VERSION env
run: echo APP_VERSION=$(echo ${GITHUB_REF} | rev | cut -d'/' -f 1 | rev ) >> ${GITHUB_ENV}
- uses: ko-build/[email protected]
env:
KO_DOCKER_REPO: ghcr.io/kndpio/cli
- name: build
env:
auth_token: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ env.APP_VERSION }}
run: |
echo "${auth_token}" | ko login ghcr.io --username KNDP --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 2f1533b

Please sign in to comment.