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 1/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E5=8F=91=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 + From d02c6dadb6d9465a93e71928ff1b87077f082d79 Mon Sep 17 00:00:00 2001 From: RikudouPatrickstar <68163551+RikudouPatrickstar@users.noreply.github.com> Date: Fri, 24 Feb 2023 23:44:32 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=8F=96=E6=B6=88=20push=20=E6=8C=87?= =?UTF-8?q?=E5=AE=9A=E5=88=86=E6=94=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release_new_version.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_new_version.yaml b/.github/workflows/release_new_version.yaml index 9883202..70f8b25 100644 --- a/.github/workflows/release_new_version.yaml +++ b/.github/workflows/release_new_version.yaml @@ -52,7 +52,7 @@ jobs: 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 + git push if [[ "${new_type}" == "正式版" ]]; then git tag ${new_version} git push origin ${new_version} From 978a81f532f48a9b37219555bfd6ddf5c24c8451 Mon Sep 17 00:00:00 2001 From: RikudouPatrickstar <68163551+RikudouPatrickstar@users.noreply.github.com> Date: Fri, 3 Mar 2023 20:52:26 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E6=B5=81=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=86=85=E6=B5=8B=E7=89=88=E6=89=93=E5=8C=85=EF=BC=9B?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=B6=E5=93=81=E5=8C=85=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/release_new_version.yaml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release_new_version.yaml b/.github/workflows/release_new_version.yaml index 70f8b25..b3e119b 100644 --- a/.github/workflows/release_new_version.yaml +++ b/.github/workflows/release_new_version.yaml @@ -10,7 +10,8 @@ on: required: true type: choice options: - - '测试版' + - '内测版' + - '公测版' - '正式版' env: new_version: ${{ github.event.inputs.release_version }} @@ -22,15 +23,16 @@ jobs: - name: Clone Repository uses: actions/checkout@main - name: Update Version Number + if: ${{ github.event.inputs.release_type != '内测版' }} run: | if [[ "${new_type}" == "正式版" ]]; then sed -i "1i ${new_version}" ./bin/release_version - else + elif [[ "${new_type}" == "公测版" ]]; then 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 == '测试版' }} + if: ${{ github.event.inputs.release_type != '正式版' }} run: | cd ./bin # 打包 clashfm.tar.gz @@ -49,6 +51,7 @@ jobs: tar zcvf ../ShellClash.tar.gz * popd && rm -fr ./ShellClash - name: Commit and push + if: ${{ github.event.inputs.release_type != '内测版' }} 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 @@ -57,4 +60,15 @@ jobs: git tag ${new_version} git push origin ${new_version} fi - + - name: Package Artifact + id: package_artifact + run: | + mkdir artifacts + cp ./bin/clashfm.tar.gz ./artifacts/ + cp ./bin/ShellClash.tar.gz ./artifacts/ + echo "artifact_name=${new_type}_${new_version}_$(date +%Y%m%d%H%M%S)" >> $GITHUB_OUTPUT + - name: Upload Test Artifact + uses: actions/upload-artifact@main + with: + name: ${{ steps.package_artifact.outputs.artifact_name }} + path: ./artifacts/*