-
Notifications
You must be signed in to change notification settings - Fork 33
89 lines (77 loc) · 2.71 KB
/
sync_openlist.yaml
File metadata and controls
89 lines (77 loc) · 2.71 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Check Updates
on:
schedule:
- cron: "0 5,17 * * *" # 每日5点和17点执行
workflow_dispatch:
inputs:
force_build:
description: 'Force build OpenList libraries'
required: false
type: boolean
default: false
push:
branches:
- "master"
paths:
- "sync_openlist.yaml"
permissions:
contents: write
actions: write
jobs:
check_and_update:
name: Check for version updates
runs-on: ubuntu-latest
outputs:
openlist_update: ${{ steps.set_output.outputs.openlist_update }}
openlist_version: ${{ steps.set_output.outputs.openlist_version }}
env:
VERSION_FILE: ${{ github.workspace }}/openlist_version
steps:
- uses: actions/checkout@v3
- name: Check OpenList Version
run: |
cd $GITHUB_WORKSPACE/.github/scripts
chmod +x ./*.sh
touch ${{ env.VERSION_FILE }}
./check_openlist.sh
- name: Set Output Variables
id: set_output
run: |
echo "openlist_version=${{ env.openlist_version }}" >> $GITHUB_OUTPUT
echo "openlist_update=${{ env.openlist_update }}" >> $GITHUB_OUTPUT
- name: Import GPG key
if: env.openlist_update == '1'
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.BOT_GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
git_tag_gpgsign: true
- name: Update Version Files
if: env.openlist_update == '1'
run: |
echo -e "${{ env.openlist_version }}" > ${{ env.VERSION_FILE }}
chmod +x $GITHUB_WORKSPACE/.github/scripts/update_pubspec_version.sh
$GITHUB_WORKSPACE/.github/scripts/update_pubspec_version.sh
git config user.name "${{ secrets.BOT_USERNAME }}"
git config user.email "${{ secrets.BOT_USEREMAIL }}"
git add .
git commit -m "[bot] Update openlist to ${{ env.openlist_version }}"
git push
build_openlist_libraries:
name: Build OpenList Libraries
needs: [check_and_update]
if: needs.check_and_update.outputs.openlist_update == '1' || inputs.force_build == true
uses: ./.github/workflows/build_openlist.yaml
trigger_release:
name: Trigger Release Workflow
needs: [check_and_update, build_openlist_libraries]
if: needs.check_and_update.outputs.openlist_update == '1' && ( success() || failure() )
runs-on: ubuntu-latest
steps:
- name: Trigger Release Workflow
run: |
gh workflow run release.yaml -R ${{ github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}