From d9f6c66b5503de0d148bfc5f0bd1b4dd05cf4de2 Mon Sep 17 00:00:00 2001 From: RikudouPatrickstar <68163551+RikudouPatrickstar@users.noreply.github.com> Date: Fri, 24 Feb 2023 22:47:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=89=88=E6=9C=AC=E5=8F=91?= =?UTF-8?q?=E5=B8=83=E6=89=93=E5=8C=85=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release_new_version.yaml | 60 ++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/release_new_version.yaml diff --git a/.github/workflows/release_new_version.yaml b/.github/workflows/release_new_version.yaml new file mode 100644 index 0000000..9883202 --- /dev/null +++ b/.github/workflows/release_new_version.yaml @@ -0,0 +1,60 @@ +name: Release New Version +on: + workflow_dispatch: + inputs: + release_version: + description: 'new version of ShellClash, such as 1.7.0f' + required: true + type: string + release_type: + required: true + type: choice + options: + - '测试版' + - '正式版' +env: + new_version: ${{ github.event.inputs.release_version }} + new_type: ${{ github.event.inputs.release_type }} +jobs: + Update: + runs-on: ubuntu-latest + steps: + - name: Clone Repository + uses: actions/checkout@main + - name: Update Version Number + run: | + if [[ "${new_type}" == "正式版" ]]; then + sed -i "1i ${new_version}" ./bin/release_version + else + sed -i "s/versionsh=.*/versionsh=${new_version}/" ./bin/version + sed -i "s/version=.*/version=${new_version}/" ./scripts/init.sh + fi + - name: Package + if: ${{ github.event.inputs.release_type == '测试版' }} + run: | + cd ./bin + # 打包 clashfm.tar.gz + rm ./clashfm.tar.gz + mkdir clashfm && pushd clashfm + cp ../../scripts/* ./ + chmod +x * + tar zcvf ../clashfm.tar.gz * + popd && rm -fr clashfm + # 打包 ShellClash.tar.gz + rm ./ShellClash.tar.gz + mkdir ShellClash && pushd ShellClash + cp ../../scripts/* ./ + chmod +x * + cp ../Country.mmdb ./ + tar zcvf ../ShellClash.tar.gz * + popd && rm -fr ./ShellClash + - name: Commit and push + run: | + git config --global user.email "juewuy@gmail.com" && git config --global user.name "Bot" + git add . && git commit -m "${new_type} ${new_version} 打包" || exit 0 + git push origin master + if [[ "${new_type}" == "正式版" ]]; then + git tag ${new_version} + git push origin ${new_version} + fi +