Skip to content

Commit

Permalink
Move to Github Action (#105)
Browse files Browse the repository at this point in the history
* Move to Github Action

Signed-off-by: galal-hussein <[email protected]>

* Move to Github Action

Signed-off-by: galal-hussein <[email protected]>

* fix code generation

* Add release and chart workflows

Signed-off-by: galal-hussein <[email protected]>

* Add release and chart workflows

Signed-off-by: galal-hussein <[email protected]>

* Add release and chart workflows

Signed-off-by: galal-hussein <[email protected]>

* Add release and chart workflows

Signed-off-by: galal-hussein <[email protected]>

* test release and charts

Signed-off-by: galal-hussein <[email protected]>

* test release and charts

Signed-off-by: galal-hussein <[email protected]>

* test release and charts

Signed-off-by: galal-hussein <[email protected]>

* test release and charts

Signed-off-by: galal-hussein <[email protected]>

* test release and charts

Signed-off-by: galal-hussein <[email protected]>

* Fix GHA migration

Signed-off-by: galal-hussein <[email protected]>

* Fix GHA migration

Signed-off-by: galal-hussein <[email protected]>

---------

Signed-off-by: galal-hussein <[email protected]>
  • Loading branch information
galal-hussein authored May 20, 2024
1 parent 0d6bf49 commit 3879912
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 166 deletions.
160 changes: 0 additions & 160 deletions .drone.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
push:
branches:
- master
pull_request:

name: Build
permissions:
contents: read
jobs:
build-cross-arch:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cross Arch Build
run: |
make ci
env:
CROSS: "true"

30 changes: 30 additions & 0 deletions .github/workflows/chart.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
push:
tags:
- "chart-*"

name: Chart
permissions:
contents: write
id-token: write
jobs:
chart-release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Package Chart
run: |
make package-chart;
- name: Release Chart
uses: softprops/action-gh-release@v2
with:
files: |
deploy/*
- name: Index Chart
run: |
make index-chart
52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
on:
push:
tags:
- "v*"

name: Release
permissions:
contents: write
id-token: write
jobs:
release-cross-arch:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cross Arch Build
run: |
make ci
env:
CROSS: "true"

- name: "Read secrets"
uses: rancher-eio/read-vault-secrets@main
with:
secrets: |
secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials username | DOCKER_USERNAME ;
secret/data/github/repo/${{ github.repository }}/dockerhub/${{ github.repository_owner }}/credentials password | DOCKER_PASSWORD ;
- name: release binaries
uses: softprops/action-gh-release@v2
with:
files: |
bin/*
- name: Login to Container Registry
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_USERNAME }}
password: ${{ env.DOCKER_PASSWORD }}

- name: Build container image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: rancher/k3k:${{ github.ref_name }}
file: package/Dockerfile
platforms: linux/amd64



3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
TARGETS := $(shell ls ops)

.dapper:
@echo Downloading dapper
@curl -sL https://releases.rancher.com/dapper/latest/dapper-$$(uname -s)-$$(uname -m) > .dapper.tmp
Expand All @@ -12,4 +11,4 @@ $(TARGETS): .dapper

.DEFAULT_GOAL := default

.PHONY: $(TARGETS)
.PHONY: $(TARGETS)
2 changes: 1 addition & 1 deletion charts/k3k/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: k3k
description: A Helm chart for K3K
type: application
version: 0.1.4-r1
version: 0.1.5-r5
appVersion: 0.2.0
1 change: 1 addition & 0 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set -o errexit
set -o nounset
set -o pipefail

set -x
CODEGEN_GIT_PKG=https://github.com/kubernetes/code-generator.git
git clone --depth 1 ${CODEGEN_GIT_PKG} || true

Expand Down
12 changes: 9 additions & 3 deletions ops/version
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
fi

COMMIT=$(git rev-parse --short HEAD)
GIT_TAG=${DRONE_TAG:-$(git tag -l --contains HEAD | head -n 1)}
GIT_TAG=${TAG:-$(git tag -l --contains HEAD | head -n 1)}

if [[ -z "$DIRTY" && -n "$GIT_TAG" ]]; then
VERSION=$GIT_TAG
Expand All @@ -19,9 +19,15 @@ fi

SUFFIX="-${ARCH}"

TAG=${TAG:-${VERSION}${SUFFIX}}

if [[ $VERSION = "chart*" ]]; then
TAG=${TAG:-${VERSION}}
else
TAG=${TAG:-${VERSION}${SUFFIX}}
fi

REPO=${REPO:-rancher}

if echo $TAG | grep -q dirty; then
if echo $TAG | grep dirty; then
TAG=dev
fi

0 comments on commit 3879912

Please sign in to comment.