-
Notifications
You must be signed in to change notification settings - Fork 16
126 lines (110 loc) · 4.79 KB
/
Copy pathci.yml
File metadata and controls
126 lines (110 loc) · 4.79 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: CI
on:
schedule:
- cron: "20 */4 * * *" # Every 4 hours
workflow_dispatch:
concurrency:
group: ci
cancel-in-progress: false
jobs:
check_patch:
permissions:
contents: write
runs-on: ubuntu-latest
timeout-minutes: 10
outputs:
trigger_stable: ${{ steps.effective_triggers.outputs.TRIGGER_STABLE }}
trigger_prerelease: ${{ steps.effective_triggers.outputs.TRIGGER_PRERELEASE }}
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: main
fetch-depth: 1
- name: Ensure patch_sources.json exists
id: ensure_patch_sources
run: bash .github/scripts/ci_ensure_patch_sources.sh
- name: Commit dummy patch_sources.json if created
if: steps.ensure_patch_sources.outputs.created == 'true'
uses: stefanzweifel/git-auto-commit-action@v7
with:
branch: main
skip_checkout: true
file_pattern: .github/configs/patch_sources.json
commit_message: "Create dummy patch_sources.json"
- name: Fetch latest tags
if: steps.ensure_patch_sources.outputs.created == 'false'
id: fetch_tags
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: bash .github/scripts/ci_fetch_tags.sh
- name: Compare latest vs stored tags
if: steps.ensure_patch_sources.outputs.created == 'false'
id: compare
env:
LATEST_TAGS: ${{ steps.fetch_tags.outputs.latest }}
run: bash .github/scripts/ci_compare_tags.sh
- name: Generate configs (JSON)
if: ${{ steps.compare.outputs.TRIGGER_STABLE == '1' || steps.compare.outputs.TRIGGER_PRERELEASE == '1' || steps.compare.outputs.TRIGGER_BLOCKED == '1' }}
id: generate_configs
env:
TAGS_OLD: ${{ steps.compare.outputs.tags_old }}
TAGS_NEW: ${{ steps.compare.outputs.tags_new }}
TRIGGER_STABLE: ${{ steps.compare.outputs.TRIGGER_STABLE }}
TRIGGER_PRERELEASE: ${{ steps.compare.outputs.TRIGGER_PRERELEASE }}
run: bash .github/scripts/ci_generate_configs.sh
- name: Resolve effective triggers
id: effective_triggers
env:
CREATED: ${{ steps.ensure_patch_sources.outputs.created }}
RAW_TRIGGER_STABLE: ${{ steps.compare.outputs.TRIGGER_STABLE }}
RAW_TRIGGER_PRERELEASE: ${{ steps.compare.outputs.TRIGGER_PRERELEASE }}
run: bash .github/scripts/ci_resolve_triggers.sh
- name: Notify telegram
if: ${{ steps.ensure_patch_sources.outputs.created == 'false' && (steps.compare.outputs.TRIGGER_STABLE == '1' || steps.compare.outputs.TRIGGER_PRERELEASE == '1' || steps.compare.outputs.TRIGGER_BLOCKED == '1') }}
env:
TG_TOKEN: ${{ secrets.TG_TOKEN }}
TAGS_OLD: ${{ steps.compare.outputs.tags_old }}
TAGS_NEW: ${{ steps.compare.outputs.tags_new }}
TRIGGER_STABLE: ${{ steps.compare.outputs.TRIGGER_STABLE }}
TRIGGER_PRERELEASE: ${{ steps.compare.outputs.TRIGGER_PRERELEASE }}
run: bash .github/scripts/ci_notify_telegram.sh
- name: Commit updated patch sources and configs
if: ${{ steps.ensure_patch_sources.outputs.created == 'false' && (steps.compare.outputs.TRIGGER_STABLE == '1' || steps.compare.outputs.TRIGGER_PRERELEASE == '1' || steps.compare.outputs.TRIGGER_BLOCKED == '1') }}
uses: stefanzweifel/git-auto-commit-action@v7
with:
branch: main
skip_checkout: true
file_pattern: .github/configs/*.json
commit_message: "Update patch sources and generated configs [skip ci]"
build_dev:
needs: check_patch
if: ${{ needs.check_patch.outputs.trigger_prerelease == '1' }}
uses: ./.github/workflows/build.yml
with:
config_file: ".github/configs/config.dev.updated.json"
secrets: inherit
build_stable:
needs: [check_patch, build_dev]
if: ${{ always() && needs.check_patch.outputs.trigger_stable == '1' && needs.check_patch.result == 'success' && needs.build_dev.result != 'cancelled' }}
uses: ./.github/workflows/build.yml
with:
config_file: ".github/configs/config.stable.updated.json"
secrets: inherit
trigger_cleanup:
needs: [build_dev, build_stable]
if: ${{ always() && (needs.build_dev.result == 'success' || needs.build_stable.result == 'success') }}
uses: ./.github/workflows/cleanup.yml
secrets: inherit
trigger_website_update:
needs: [build_dev, build_stable, trigger_cleanup]
if: ${{ always() && (needs.build_dev.result == 'success' || needs.build_stable.result == 'success') }}
uses: ./.github/workflows/update-website.yml
secrets: inherit
trigger_notify_failure:
needs: [check_patch, build_dev, build_stable]
if: ${{ failure() }}
uses: ./.github/workflows/notify.yml
with:
workflow_name: "CI"
secrets: inherit