-
Notifications
You must be signed in to change notification settings - Fork 205
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #313 from jumpserver/master
feat( CI ): 构建CI相关的actions
- Loading branch information
Showing
5 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[简述你的问题] | ||
|
||
##### 使用版本 | ||
[请提供你使用的 Koko 版本 如 2.0.1 注: 1.4及以下版本不再提供支持] | ||
|
||
##### 问题复现步骤 | ||
1. [步骤1] | ||
2. [步骤2] | ||
|
||
##### 具体表现[截图可能会更好些,最好能截全] | ||
|
||
|
||
##### 其他 | ||
|
||
|
||
[注:] 完成后请关闭 issue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name-template: 'v$RESOLVED_VERSION' | ||
tag-template: 'v$RESOLVED_VERSION' | ||
categories: | ||
- title: '🌱 新功能 Features' | ||
labels: | ||
- 'feature' | ||
- 'enhancement' | ||
- 'feat' | ||
- '新功能' | ||
- title: '🚀 性能优化 Optimization' | ||
labels: | ||
- 'perf' | ||
- 'opt' | ||
- 'refactor' | ||
- 'Optimization' | ||
- '优化' | ||
- title: '🐛 Bug修复 Bug Fixes' | ||
labels: | ||
- 'fix' | ||
- 'bugfix' | ||
- 'bug' | ||
- title: '🧰 其它 Maintenance' | ||
labels: | ||
- 'chore' | ||
- 'docs' | ||
exclude-labels: | ||
- 'no' | ||
- '无需处理' | ||
- 'wontfix' | ||
change-template: '- $TITLE @$AUTHOR (#$NUMBER)' | ||
version-resolver: | ||
major: | ||
labels: | ||
- 'major' | ||
minor: | ||
labels: | ||
- 'minor' | ||
patch: | ||
labels: | ||
- 'patch' | ||
default: patch | ||
template: | | ||
## 版本变化 What’s Changed | ||
$CHANGES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
name: Create Release And Upload assets | ||
|
||
jobs: | ||
create-realese: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
outputs: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Get version | ||
id: get_version | ||
run: | | ||
TAG=$(basename ${GITHUB_REF}) | ||
VERSION=${TAG/v/} | ||
echo "::set-output name=TAG::$TAG" | ||
echo "::set-output name=VERSION::$VERSION" | ||
- name: Create Release | ||
id: create_release | ||
uses: release-drafter/release-drafter@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
config-name: release-config.yml | ||
version: ${{ steps.get_version.outputs.VERSION }} | ||
tag: ${{ steps.get_version.outputs.TAG }} | ||
|
||
build-and-release: | ||
needs: create-realese | ||
name: Build and Release | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
os: [linux, darwin] | ||
arch: [amd64] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build it and upload | ||
uses: jumpserver/action-build-upload-assets@golang | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ needs.create-realese.outputs.upload_url }} | ||
os: ${{ matrix.os }} | ||
arch: ${{ matrix.arch }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,3 +20,4 @@ cmd/koko | |
cmd/logs | ||
cmd/kokodir | ||
build | ||
release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
# | ||
# 该build基于 golang:1.12-alpine | ||
utils_dir=$(pwd) | ||
project_dir=$(dirname "$utils_dir") | ||
release_dir=${project_dir}/release | ||
|
||
function install_git() { | ||
sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories \ | ||
&& apk update \ | ||
&& apk add git | ||
} | ||
|
||
|
||
if [[ $(uname) == 'Darwin' ]];then | ||
alias sedi="sed -i ''" | ||
else | ||
alias sedi='sed -i' | ||
fi | ||
|
||
|
||
# 安装依赖包 | ||
command -v git || install_git | ||
|
||
# 修改版本号文件 | ||
if [[ -n ${VERSION} ]]; then | ||
sedi "s@Version = .*@Version = \"${VERSION}\"@g" "${project_dir}/pkg/koko/koko.go" || exit 2 | ||
fi | ||
|
||
|
||
# 下载依赖模块并构建 | ||
cd .. && go mod download || exit 3 | ||
cd cmd && go build -ldflags "-X 'main.Buildstamp=`date -u '+%Y-%m-%d %I:%M:%S%p'`' -X 'main.Githash=`git rev-parse HEAD`' -X 'main.Goversion=`go version`'" -o koko koko.go || exit 4 | ||
|
||
# 打包 | ||
rm -rf "${release_dir:?}/*" | ||
to_dir="${release_dir}/koko" | ||
mkdir -p "${to_dir}" | ||
|
||
for i in koko static templates locale config_example.yml;do | ||
cp -r $i "${to_dir}" | ||
done | ||
|