实现 get_group_info、get_status #97
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Build (Dev)' | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: [self-hosted, linux, x64] | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # 这里获取所有历史记录和标签 | |
- name: Setting up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10.12' | |
cache: 'pip' | |
cache-dependency-path: | | |
requirements.txt | |
- name: Update Pip and Install Requirements | |
run: | | |
pip install -U pip | |
pip install -r requirements.txt | |
pip install pyinstaller | |
sudo apt update | |
sudo apt install binutils git zip -y | |
- name: Build on Linux | |
run: | | |
pyinstaller --onefile main.py | |
- name: Get version number | |
run: | | |
export VERSION=$(python -c 'print(__import__("version").VERSION)') | |
export SUB_VER=$(git rev-list --no-merges --count $(git describe --tags --abbrev=0)..HEAD) | |
echo "VERSION=$VERSION.$SUB_VER" >> $GITHUB_ENV | |
echo "Currect Version Number: $VERSION.$SUB_VER" | |
- name: Compress file | |
run: | | |
cd dist | |
mv main onedisc | |
zip -r "/tmp/OneDisc-linux-x86_64-dev.zip" onedisc | |
- name: Publish application | |
run: | | |
cd /tmp | |
rm -rf OneDisc-Build | |
git clone https://github.com/This-is-XiaoDeng/OneDisc-Build.git | |
cd OneDisc-Build | |
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/This-is-XiaoDeng/OneDisc-Build.git | |
mkdir beta --parents | |
cd beta | |
mv /tmp/OneDisc-linux-x86_64-dev.zip . | |
cd /tmp/OneDisc-Build | |
cat ./version.json | |
export VER_JSON=$(python3 -c 'os = __import__("os");json = __import__("json");data = json.load(open("./version.json", encoding="utf-8"));data["beta"] = os.environ["VERSION"];print(json.dumps(data))') | |
echo $VER_JSON > version.json | |
git add -A | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "action@github.com" | |
git commit -m "Update version to $VERSION" | |
git push | |
env: | |
VERSION: ${{ env.VERSION }} | |
GH_TOKEN: ${{ secrets.GH_TOKEN_1 }} | |