更新测试版本至 v1.0.1-beta2 #592
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 Seraphine | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build-seraphine: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
cache: 'pip' | |
- name: Pack Seraphine | |
run: | | |
pip install -r requirements.txt | |
pip install pyinstaller==5.13 | |
.\make.ps1 | |
echo "SUCCESS=true" >> $GITHUB_ENV | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
if: ${{ env.SUCCESS }} == 'true' | |
with: | |
name: Seraphine | |
path: .\Seraphine.7z | |
release: | |
needs: build-seraphine | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup environment variables | |
run: | | |
export VERSION_CHANGED_COMMIT_HASH=$(git blame app/common/config.py --root -l | grep -Po "([\w]+) (?=\(.*\) VERSION = )") | |
export HEAD_COMMIT_HASH=$(git log -1 --format='%H') | |
export UPDATED=$(python -c "import os; UPDATED = 'true' if os.environ['HEAD_COMMIT_HASH'].strip() == os.environ['VERSION_CHANGED_COMMIT_HASH'].strip() else 'false'; print(UPDATED)") | |
export VERSION=$(cat app/common/config.py | grep -Po "(?<=VERSION = \")(.*[^\"])") | |
echo "VERSION=v$VERSION" >> $GITHUB_ENV | |
echo "UPDATED=$UPDATED" >> $GITHUB_ENV | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
if: env.UPDATED == 'true' | |
with: | |
name: Seraphine | |
path: ./ | |
- name: Push to release | |
uses: ncipollo/release-action@v1 | |
if: env.UPDATED == 'true' | |
with: | |
name: ${{ env.VERSION }} | |
tag: ${{ env.VERSION }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
replacesArtifacts: false | |
artifacts: Seraphine.7z | |
- name: Sync to Gitee | |
if: env.UPDATED == 'true' | |
env: | |
GITEE_OWNER: Zzaphkiel | |
GITEE_REPO: seraphine | |
GITEE_USERNAME: ${{ secrets.GITEE_USERNAME }} | |
GITEE_PASSWORD: ${{ secrets.GITEE_PASSWORD }} | |
GITEE_CLIENT_ID: ${{ secrets.GITEE_CLIENT_ID }} | |
GITEE_CLIENT_SECRET: ${{ secrets.GITEE_CLIENT_SECRET }} | |
run: | | |
python3 sync.py --tag "$VERSION" |