Skip to content

Commit

Permalink
Update v1.0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
george012 committed Oct 30, 2023
1 parent fdfb896 commit edaf508
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 36 deletions.
43 changes: 37 additions & 6 deletions .github/workflows/npm-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches: [ main ]

jobs:
build:
Build:
runs-on: ubuntu-latest
strategy:
matrix:
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:

RemoveOldRelease:
runs-on: ubuntu-latest
needs: build
needs: Build
steps:
- name: install github-cli
run: |
Expand All @@ -57,13 +57,44 @@ jobs:
&& sudo apt install gh -y
- name: CheckOut
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set APP_VERSION env
run: |
sudo chmod a+x git_push.sh \
&& pre_del_tag=$(./git_push.sh -get_pre_del_tag_name) \
&& echo APP_OLD_VERSION=v${pre_del_tag} >> ${GITHUB_ENV}
APP_VERSION=$(echo ${GITHUB_REF} | rev | cut -d'/' -f 1 | rev ) \
function get_pre_del_tag {
local v_str=$1
baseStr=$(echo $v_str | cut -d'.' -f1)
base=${baseStr//v/}
major=$(echo $v_str | cut -d'.' -f2)
minor=$(echo $v_str | cut -d'.' -f3)
if ((minor>0)); then
minor=$((minor-1))
else
minor=999
if ((major>0)); then
major=$((major-1))
else
major=999
if ((base>0)); then
base=$((base-1))
else
echo "Error: Version cannot be decremented."
exit 1
fi
fi
fi
pre_v_no="v${base}.${major}.${minor}"
echo $pre_v_no
}
APP_OLD_VERSION=$(get_pre_del_tag $(get_pre_del_tag $APP_VERSION))
echo "Old version to remove: ${APP_OLD_VERSION}"
echo APP_OLD_VERSION=${APP_OLD_VERSION} >> ${GITHUB_ENV}
- name: Remove Old Release
run: |
Expand Down
33 changes: 6 additions & 27 deletions git_tag.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ CURRENT_VERSION=$(jq -r '.version' $VersionFile)

NEXT_VERSION=""

OSTYPE="Unknown"
OS_TYPE="Unknown"
GetOSType() {
uNames=`uname -s`
osName=${uNames: 0: 4}
if [ "$osName" == "Darw" ] # Darwin
then
OSTYPE="Darwin"
OS_TYPE="Darwin"
elif [ "$osName" == "Linu" ] # Linux
then
OSTYPE="Linux"
OS_TYPE="Linux"
elif [ "$osName" == "MING" ] # MINGW, windows, git-bash
then
OSTYPE="Windows"
OS_TYPE="Windows"
else
OSTYPE="Unknown"
OS_TYPE="Unknown"
fi
}
GetOSType
Expand Down Expand Up @@ -101,30 +101,9 @@ function git_handle_ready() {

local netx_version_no=${NEXT_VERSION//v/}

# 检查dos2unix是否存在,如果不存在,尝试安装
case "$(uname -s)" in
Linux)
if [[ -f "/etc/debian_version" ]]; then
sudo apt-get update
sudo apt-get install -y dos2unix
elif [[ -f "/etc/redhat-release" ]]; then
sudo yum install -y dos2unix
else
echo "Unknown Linux distribution. Please install dos2unix manually."
fi
;;

Darwin) # macOS
brew install dos2unix
;;
*)
echo "Unsupported OS. Please install dos2unix manually."
;;
esac

jq ".version = \"${netx_version_no}\"" $VersionFile > temp.json

if command -v dos2unix &> /dev/null; then
if [[ $OS_TYPE == "Darwin" ]]; then
dos2unix temp.json
fi

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"@aws-sdk/client-s3": "^3"
},
"name": "cloudflare-r2-upload",
"version": "1.0.13",
"version": "1.0.14",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down

0 comments on commit edaf508

Please sign in to comment.