mirror of https://github.com/jumpserver/jumpserver
ci(release&build): 添加 github workflows, 自动构建 release
- 添加 utils/build.sh 脚本,构建后放到 release 目录中 - 当 push tags时,自动创建 Release Draft - 自动生成 Release Change Log - 自动构建包,上传到 Release Assetspull/4257/head
parent
8c4e9720d3
commit
3077d11483
|
@ -0,0 +1,44 @@
|
|||
name-template: 'Release 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
|
|
@ -0,0 +1,38 @@
|
|||
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: Create Release
|
||||
id: create_release
|
||||
uses: release-drafter/release-drafter@v5
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
config-name: release-config.yml
|
||||
|
||||
build-and-release:
|
||||
needs: create-realese
|
||||
name: Build and Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Build it and upload
|
||||
uses: ibuler/action-build-upload@master
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
upload_url: ${{ needs.create-realese.outputs.upload_url }}
|
|
@ -35,4 +35,6 @@ docs/_build/
|
|||
xpack
|
||||
logs/*
|
||||
### Vagrant ###
|
||||
.vagrant/
|
||||
.vagrant/
|
||||
release/*
|
||||
releashe
|
||||
|
|
11
build.sh
11
build.sh
|
@ -1,11 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
|
||||
version=$1
|
||||
if [ -z "$version" ];then
|
||||
echo "Usage: sh build version"
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
docker build -t jumpserver/jumpserver:$version .
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# 该build基于registry.fit2cloud.com/public/python:3
|
||||
utils_dir=$(pwd)
|
||||
project_dir=$(dirname "$utils_dir")
|
||||
release_dir=${project_dir}/release
|
||||
|
||||
# 编译翻译文件
|
||||
cd "${project_dir}/apps" && python manage.py compilemessages
|
||||
|
||||
# 打包
|
||||
cd "${project_dir}" || exit 3
|
||||
rm -rf "${release_dir:?}/*"
|
||||
to_dir="${release_dir}/jumpserver"
|
||||
mkdir -p "${to_dir}"
|
||||
git archive --format tar HEAD | tar x -C "${to_dir}"
|
||||
|
||||
# 修改版本号文件
|
||||
if [[ -n ${VERSION} ]]; then
|
||||
sed -i "" "s@VERSION = .*@VERSION = \"${VERSION}\"@g" "${release_dir}/jumpserver/apps/jumpserver/const.py"
|
||||
fi
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
utils_dir=$(dirname "$0")
|
||||
project_dir=$(dirname "${utils_dir}")
|
||||
|
||||
version=$1
|
||||
if [ -z "$version" ]; then
|
||||
echo "Usage: sh build version"
|
||||
exit
|
||||
fi
|
||||
|
||||
cd "${project_dir}" && docker build -t "jumpserver/jumpserver:${version}" .
|
Loading…
Reference in New Issue