Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-0.5] Add a github action to publish release assets automatically #947

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build Release

on:
release:
types:
- published

permissions:
contents: read
jobs:
kmeshctl-assets:
permissions:
contents: write # for softprops/action-gh-release to create GitHub release
name: release kmeshctl
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
go-version: [ '1.23' ]
target:
- kmeshctl
os:
- linux
arch:
- amd64
- arm64
steps:
- uses: actions/checkout@v4

- name: Setup go
uses: actions/[email protected]
with:
go-version: ${{ matrix.go-version }}

- name: Making and packaging
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
run: make kmeshctl OUT=kmeshctl-${{ matrix.os }}-${{ matrix.arch }}
- name: Uploading kmeshctl assets
uses: softprops/action-gh-release@v2
with:
files: |
kmeshctl-${{ matrix.os }}-${{ matrix.arch }}

kmesh-helm:
permissions:
contents: write # for softprops/action-gh-release to create GitHub release
name: Release helm
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Making helm package
env:
VERSION: ${{ github.ref_name }}
run: make helm-package CHART_VERSION=${{ github.ref_name }}
- name: Uploading kmesh helm package
uses: softprops/action-gh-release@v2
with:
files: |
out/charts/kmesh-helm-${{ github.ref_name }}.tgz
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 The Kmesh Authors.
# Copyright The Kmesh Authors.

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -100,6 +100,13 @@ all:
$(QUIET) (export PKG_CONFIG_PATH=$(PKG_CONFIG_PATH):$(ROOT_DIR)mk; \
$(GO) build -ldflags $(LDFLAGS) -o $(APPS4) $(GOFLAGS) ./ctl/main.go)

OUT ?= kmeshctl
.PHONY: kmeshctl
kmeshctl:
$(call printlog, BUILD, $(APPS4))
$(QUIET) (export PKG_CONFIG_PATH=$(PKG_CONFIG_PATH):$(ROOT_DIR)mk; \
$(GO) build -o $(OUT) $(GOFLAGS) ./ctl/main.go)

.PHONY: gen-proto
gen-proto:
$(QUIET) make -C api gen-proto
Expand Down Expand Up @@ -221,7 +228,9 @@ helm-package.%: # Package Helm chart
$(eval COMMAND := $(word 1,$(subst ., ,$*)))
$(eval CHART_NAME := $(COMMAND))
helm lint $(CHARTS_FOLDER)/${CHART_NAME}
sed -i "s/tag: latest/tag: ${CHART_VERSION}/g" $(CHARTS_FOLDER)/${CHART_NAME}/values.yaml
helm package $(CHARTS_FOLDER)/${CHART_NAME} --app-version ${VERSION} --version ${CHART_VERSION} --destination ${CHART_OUTPUT_DIR}/
git checkout -- $(CHARTS_FOLDER)/${CHART_NAME}/values.yaml

.PHONY: helm-push.%
helm-push.%: helm-package.%
Expand Down
Loading