新增版本发布打包工作流

This commit is contained in:
RikudouPatrickstar 2023-02-24 22:47:18 +08:00
parent 4fb47be400
commit d9f6c66b55

View File

@ -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