forked from obsproject/obs-studio
-
Notifications
You must be signed in to change notification settings - Fork 2
206 lines (183 loc) · 7.65 KB
/
scheduled.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
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
name: Scheduled
run-name: Scheduled Repository Actions ⏰
on:
schedule:
- cron: 17 0 * * *
permissions:
contents: write
concurrency:
group: '${{ github.workflow }} @ ${{ github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
services-availability:
name: Check Service Availability 🛜
if: github.repository_owner == 'obsproject'
runs-on: macos-14
permissions:
checks: write
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set Up Homebrew 🍺
uses: Homebrew/actions/setup-homebrew@master
- name: Check for Defunct Services 📉
uses: ./.github/actions/services-validator
with:
repositorySecret: ${{ secrets.GITHUB_TOKEN }}
checkApiSecret: ${{ secrets.CHECK_SERVERS_API_KEY }}
checkApiServers: ${{ secrets.CHECK_SERVERS_LIST }}
runSchemaChecks: false
runServiceChecks: true
createPullRequest: true
cache-cleanup:
name: Cache Cleanup 🧹
runs-on: ubuntu-24.04
permissions:
actions: write
steps:
- name: Remove Stale Ccache Caches
env:
GH_TOKEN: ${{ github.token }}
run: |
: Remove Stale Ccache Caches
# The jq expressions below use multiple 'select' calls to filter
# each item in the array with the 'actions_caches' key.
# First it only selects objects whose 'ref' element has the value
# 'refs/heads/master', of those objects only those whose 'key'
# value matches the specifies expression, before finally only
# selecting the 'id' and 'key' elements for a new object.
# The final 'join' command combines both elements with a semicolon
# into a raw string which can then be parsed directly.
echo '::group::Processing master branch cache entries'
while IFS=";" read -r cache_id cache_name; do
if [[ "${cache_name}" ]]; then
result=true
gh api -X DELETE repos/${GITHUB_REPOSITORY}/actions/caches?key=${cache_name} --jq '.total_count' &> /dev/null || result=false
if ${result}; then
echo "Deleted cache entry ${cache_name}"
else
echo "::warning::Unable to delete cache entry ${cache_name}"
fi
fi
done <<< \
"$(gh api repos/${GITHUB_REPOSITORY}/actions/caches \
--jq '.actions_caches.[] | select(.ref|test("refs/heads/master")) | select(.key|test(".*-ccache-*")) | {id, key} | join(";")')"
echo '::endgroup::'
echo '::group::Processing pull request cache entries'
while IFS=";" read -r cache_id cache_name cache_ref; do
if [[ "${cache_name}" ]]; then
result=true
gh api -X DELETE repos/${GITHUB_REPOSITORY}/actions/caches?key=${cache_name} --jq '.total_count' &> /dev/null || result=false
pr_number=$(echo ${cache_ref} | cut -d '/' -f 3)
if ${result}; then
echo "Deleted PR #${pr_number} cache entry ${cache_name}"
else
echo "::warning::Unable to delete PR #${pr_number} cache entry ${cache_name}"
fi
fi
done <<< \
"$(gh api repos/${GITHUB_REPOSITORY}/actions/caches \
--jq '.actions_caches.[] | select(.ref|test("refs/heads/master")|not) | select(.key|test(".*-ccache-*")) | {id, key, ref} | join(";")')"
echo '::endgroup::'
build-project:
name: Build 🧱
uses: ./.github/workflows/build-project.yaml
needs: cache-cleanup
secrets: inherit
analyze-project:
name: Analyze 🔬
uses: ./.github/workflows/analyze-project.yaml
needs: cache-cleanup
secrets: inherit
permissions:
security-events: write
upload-language-files:
name: Upload Language Files 🌐
if: github.repository_owner == 'obsproject' && github.ref_name == 'master'
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Check Nightly Runs ☑️
id: nightly-checks
env:
GH_TOKEN: ${{ github.token }}
run: |
: Check Nightly Runs ☑️
if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi
# This 'gh' command retrieves the last 2 runs of the workflow defined
# by 'scheduled.yaml' and retrieve only the 'headSha' value of the
# JSON response payload.
#
# As this job runs in context of the same workflow, the first element
# of the workflow list will be the currently active run.
#
# The jq expression then selects the 'headSha' element of the second
# element in the array, which is the SHA-1 hash of the commit used
# for the immediately prior run of this workflow.
last_nightly=$(gh run list --workflow scheduled.yaml --limit 2 --json headSha --jq '.[1].headSha')
if [[ "${GITHUB_SHA}" == "${last_nightly}" ]]; then
echo "passed=false" >> $GITHUB_OUTPUT
else
echo "passed=true" >> $GITHUB_OUTPUT
echo "lastNightly=${last_nightly}" >> $GITHUB_OUTPUT
fi
- name: Check for Changed Files ✅
if: fromJSON(steps.nightly-checks.outputs.passed)
uses: ./.github/actions/check-changes
id: checks
with:
baseRef: ${{ steps.nightly-checks.outputs.lastNightly }}
checkGlob: '**/en-US.ini'
- name: Upload US English Language Files 🇺🇸
if: steps.checks.outcome == 'success' && fromJSON(steps.checks.outputs.hasChangedFiles)
uses: obsproject/obs-crowdin-sync/upload@84628cad04d2423e02443c64965cb834b4c5a245
env:
CROWDIN_PAT: ${{ secrets.CROWDIN_SYNC_CROWDIN_PAT }}
GITHUB_EVENT_BEFORE: ${{ steps.nightly-checks.outputs.lastNightly }}
steam-upload:
name: Upload Steam Builds 🚂
needs: [build-project]
if: github.repository_owner == 'obsproject'
runs-on: macos-14
defaults:
run:
shell: zsh --no-rcs --errexit --pipefail {0}
steps:
- uses: actions/checkout@v4
- name: Check Nightly Runs ☑️
id: checks
env:
GH_TOKEN: ${{ github.token }}
run: |
: Check Nightly Runs ☑️
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
# This 'gh' command retrieves the last 2 runs of the workflow defined
# by 'scheduled.yaml' and retrieve only the 'headSha' value of the
# JSON response payload.
#
# As this job runs in context of the same workflow, the first element
# of the workflow list will be the currently active run.
#
# The jq expression then selects the 'headSha' element of the second
# element in the array, which is the SHA-1 hash of the commit used
# for the immediately prior run of this workflow.
local last_nightly=$(gh run list --workflow scheduled.yaml --limit 2 --json headSha --jq '.[1].headSha')
if [[ "${GITHUB_SHA}" == "${last_nightly}" ]] {
print "passed=false" >> $GITHUB_OUTPUT
} else {
print "passed=true" >> $GITHUB_OUTPUT
}
- uses: ./.github/actions/steam-upload
if: fromJSON(steps.checks.outputs.passed)
with:
steamSecret: ${{ secrets.STEAM_SHARED_SECRET }}
steamUser: ${{ secrets.STEAM_USER }}
steamPassword: ${{ secrets.STEAM_PASSWORD }}
workflowSecret: ${{ secrets.GITHUB_TOKEN }}
preview: ${{ github.repository_owner != 'obsproject' }}