forked from obsproject/obs-studio
-
Notifications
You must be signed in to change notification settings - Fork 0
164 lines (145 loc) · 5.61 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
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-13
permissions:
checks: write
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
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 }}
runSchemaChecks: false
runServiceChecks: true
createPullRequest: true
cache-cleanup:
name: Cache Cleanup 🧹
runs-on: ubuntu-22.04
permissions:
actions: write
steps:
- name: Remove Stale Ccache Caches
env:
GH_TOKEN: ${{ github.token }}
run: |
: Remove Stale Ccache Caches
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
upload-language-files:
name: Upload Language Files 🌐
if: github.repository_owner == 'obsproject' && github.ref_name == 'master'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
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
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 ✅
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: fromJSON(steps.checks.outputs.hasChangedFiles) && fromJSON(steps.nightly-checks.outputs.passed)
uses: obsproject/obs-crowdin-sync/upload@30b5446e3b5eb19595aa68a81ddf896a857302cf
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-13
defaults:
run:
shell: zsh --no-rcs --errexit --pipefail {0}
steps:
- uses: actions/checkout@v3
- name: Check Nightly Runs ☑️
id: checks
env:
GH_TOKEN: ${{ github.token }}
run: |
: Check Nightly Runs ☑️
if (( ${+RUNNER_DEBUG} )) setopt XTRACE
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' }}