-
Notifications
You must be signed in to change notification settings - Fork 124
75 lines (72 loc) · 2.41 KB
/
build_seraphine.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
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"