Skip to content

Commit

Permalink
fix: 修正版本错误
Browse files Browse the repository at this point in the history
  • Loading branch information
wojiushixiaobai committed Jul 4, 2024
1 parent 9198e33 commit 27cae49
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 33 deletions.
37 changes: 19 additions & 18 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,41 @@ on:
name: Create Release And Upload assets

jobs:
create-realese:
create-release: # 修正了拼写错误
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4

- 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"
echo "TAG=$TAG" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: release-drafter/release-drafter@v5
uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
config-name: release-config.yml
version: ${{ steps.get_version.outputs.TAG }}
tag: ${{ steps.get_version.outputs.TAG }}

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: jumpserver/action-build-upload-assets@master

- name: Create Upload Assets
run: |
mkdir -p build jumpserver-installer-${{ steps.get_version.outputs.TAG }}
git archive --format tar HEAD | tar x -C jumpserver-installer-${{ steps.get_version.outputs.TAG }}
tar -czf build/jumpserver-installer-${{ steps.get_version.outputs.TAG }}.tar.gz jumpserver-installer-${{ steps.get_version.outputs.TAG }}
cd build
md5sum jumpserver-installer-${{ steps.get_version.outputs.TAG }}.tar.gz > jumpserver-installer-${{ steps.get_version.outputs.TAG }}.tar.gz.md5
- name: Release Upload Assets
run: |
gh release upload ${{ steps.get_version.outputs.TAG }} build/* -R $GITHUB_REPOSITORY
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-realese.outputs.upload_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion cn-quick_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ function get_installer() {

function config_installer() {
cd /opt/jumpserver-installer-${VERSION} || exit 1
sed -i "s/VERSION=.*/VERSION=${VERSION}/g" /opt/jumpserver-installer-${VERSION}/static.env
sed -i "s/# DOCKER_IMAGE_MIRROR=1/DOCKER_IMAGE_MIRROR=1/g" /opt/jumpserver-installer-${VERSION}/config-example.txt
./jmsctl.sh install
./jmsctl.sh start
Expand Down
1 change: 0 additions & 1 deletion quick_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ function get_installer() {

function config_installer() {
cd /opt/jumpserver-installer-${VERSION} || exit 1
sed -i "s/VERSION=.*/VERSION=${VERSION}/g" /opt/jumpserver-installer-${VERSION}/static.env
./jmsctl.sh install
./jmsctl.sh start
}
Expand Down
45 changes: 32 additions & 13 deletions scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,29 +108,48 @@ function disable_config() {
}

function check_db_data() {
db_type=$1
if [[ ! -f "${CONFIG_FILE}" ]]; then
return
fi
volume_dir=$(get_config VOLUME_DIR)
db_name=$(get_config DB_NAME)
if [[ -d "${volume_dir}/${db_type}/data/${db_name}" ]]; then
echo "1"
fi
db_type=$1
if [[ ! -f "${CONFIG_FILE}" ]]; then
return
fi
volume_dir=$(get_config VOLUME_DIR)
if [[ -d "${volume_dir}/${db_type}/data" ]]; then
echo "1"
else
echo "0"
fi
}

function get_db_info() {
info_type=$1
mysql_data_exists=$(check_db_data "mysql")
mariadb_data_exists=$(check_db_data "mariadb")
db_engine=$(get_config DB_ENGINE "mysql")
db_host=$(get_config DB_HOST)

mysql_data_exists="0"
mariadb_data_exists="0"
postgres_data_exists="0"

case "${db_engine}" in
"mysql")
if [[ "${db_host}" == "mysql" ]]; then
mysql_data_exists=$(check_db_data "mysql")
mariadb_data_exists=$(check_db_data "mariadb")
else
mariadb_data_exists="1"
fi
;;
"postgresql")
postgres_data_exists="1"
;;
esac

case "${info_type}" in
"image")
if [[ "${mysql_data_exists}" == "1" ]]; then
echo "mysql:5.7"
elif [[ "${mariadb_data_exists}" == "1" ]]; then
echo "mariadb:10.6"
else
elif [[ "${postgres_data_exists}" == "1" ]]; then
echo "postgres:16.3-bullseye"
fi
;;
Expand All @@ -139,7 +158,7 @@ function get_db_info() {
echo "compose/mysql.yml"
elif [[ "${mariadb_data_exists}" == "1" ]]; then
echo "compose/mariadb.yml"
else
elif [[ "${postgres_data_exists}" == "1" ]]; then
echo "compose/postgres.yml"
fi
;;
Expand Down

0 comments on commit 27cae49

Please sign in to comment.