forked from imaviso/dwproton-flake
-
Notifications
You must be signed in to change notification settings - Fork 0
334 lines (282 loc) · 15.3 KB
/
Copy pathupdate.yml
File metadata and controls
334 lines (282 loc) · 15.3 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
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
name: Update Proton versions
on:
schedule:
- cron: "0 0 * * *" # Daily at midnight
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v19
- name: Check for new DW Proton version
id: check_dw_proton_version
run: |
# Get current versions
CURRENT_VERSION=$(grep 'version = ' dw-proton.nix | sed 's/.*version = "\(.*\)";/\1/')
echo "Current version: $CURRENT_VERSION"
# Get latest release from DawnWine Forgejo API with error handling
echo "Fetching releases from DawnWine API..."
RESPONSE=$(curl -s -w "\n%{http_code}" "https://dawn.wine/api/v1/repos/dawn-winery/dwproton/releases")
HTTP_CODE=$(echo "$RESPONSE" | tail -n 1)
JSON_RESPONSE=$(echo "$RESPONSE" | head -n -1)
echo "HTTP Status Code: $HTTP_CODE"
if [ "$HTTP_CODE" != "200" ]; then
echo "Error: DawnWine API returned HTTP $HTTP_CODE"
echo "Response: $JSON_RESPONSE"
exit 1
fi
# Check if response is valid JSON and contains releases
if ! echo "$JSON_RESPONSE" | jq empty 2>/dev/null; then
echo "Error: Invalid JSON response from DawnWine API"
echo "Response: $JSON_RESPONSE"
exit 1
fi
# Check if response is an array
if [ "$(echo "$JSON_RESPONSE" | jq 'type')" != '"array"' ]; then
echo "Error: DawnWine API response is not an array"
echo "Response type: $(echo "$JSON_RESPONSE" | jq 'type')"
echo "Response: $JSON_RESPONSE"
exit 1
fi
# Get the latest dwproton release tag
LATEST_TAG=$(echo "$JSON_RESPONSE" | jq -r '.[] | select(.tag_name | startswith("dwproton-")) | .tag_name' | head -1)
if [ -z "$LATEST_TAG" ] || [ "$LATEST_TAG" = "null" ]; then
echo "Error: Could not find dwproton release"
echo "Available releases:"
echo "$JSON_RESPONSE" | jq -r '.[].tag_name' | head -10
exit 1
fi
# Remove 'dwproton-' prefix to get version
LATEST_VERSION=${LATEST_TAG#dwproton-}
echo "Latest tag: $LATEST_TAG"
echo "Latest version: $LATEST_VERSION"
# Check if version is different
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then
echo "New version available!"
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "latest_version=$LATEST_VERSION" >> $GITHUB_OUTPUT
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
echo "update_needed=true" >> $GITHUB_OUTPUT
else
echo "No update needed"
echo "update_needed=false" >> $GITHUB_OUTPUT
fi
- name: Calculate new DW Proton hash
if: steps.check_dw_proton_version.outputs.update_needed == 'true'
id: calc_dw_proton_hash
run: |
URL="https://dawn.wine/dawn-winery/dwproton/releases/download/${{ steps.check_dw_proton_version.outputs.latest_tag }}/dwproton-${{ steps.check_dw_proton_version.outputs.latest_version }}-x86_64.tar.xz"
echo "Calculating hash for: $URL"
HASH=$(nix-prefetch-url --unpack "$URL")
SRI_HASH=$(nix hash convert --to sri sha256:$HASH)
echo "Hash: $HASH"
echo "SRI Hash: $SRI_HASH"
echo "sri_hash=$SRI_HASH" >> $GITHUB_OUTPUT
- name: Update dw-proton.nix
if: steps.check_dw_proton_version.outputs.update_needed == 'true'
run: |
# Update version
sed -i 's/version = ".*";/version = "${{ steps.check_dw_proton_version.outputs.latest_version }}";/' dw-proton.nix
# Update hash (using SRI format) - use | as delimiter to avoid issues with / in hash
sed -i 's|hash = ".*";|hash = "${{ steps.calc_dw_proton_hash.outputs.sri_hash }}";|' dw-proton.nix
- name: Create DW Proton Pull Request
if: steps.check_dw_proton_version.outputs.update_needed == 'true'
id: create_dwproton_pr
uses: peter-evans/create-pull-request@v7
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update dw-proton to ${{ steps.check_dw_proton_version.outputs.latest_version }}"
title: "Update dw-proton to ${{ steps.check_dw_proton_version.outputs.latest_version }}"
body: |
Automated update of dw-proton from ${{ steps.check_dw_proton_version.outputs.current_version }} to ${{ steps.check_dw_proton_version.outputs.latest_version }}.
- **Previous version**: ${{ steps.check_dw_proton_version.outputs.current_version }}
- **New version**: ${{ steps.check_dw_proton_version.outputs.latest_version }}
- **Release tag**: ${{ steps.check_dw_proton_version.outputs.latest_tag }}
- **Release URL**: https://dawn.wine/dawn-winery/dwproton/releases/tag/${{ steps.check_dw_proton_version.outputs.latest_tag }}
This PR was automatically generated by the update workflow.
branch: update-dw-proton
delete-branch: true
- name: Check for new GE Proton version
id: check_ge_proton_version
run: |
# Get current versions
CURRENT_VERSION=$(grep 'version = ' ge-proton.nix | sed 's/.*version = "\(.*\)";/\1/')
echo "Current version: $CURRENT_VERSION"
# Get latest release from GitHub API with error handling
echo "Fetching releases from GitHub API..."
RESPONSE=$(curl -s -w "\n%{http_code}" "https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases")
HTTP_CODE=$(echo "$RESPONSE" | tail -n 1)
JSON_RESPONSE=$(echo "$RESPONSE" | head -n -1)
echo "HTTP Status Code: $HTTP_CODE"
if [ "$HTTP_CODE" != "200" ]; then
echo "Error: GitHub API returned HTTP $HTTP_CODE"
echo "Response: $JSON_RESPONSE"
exit 1
fi
# Check if response is valid JSON and contains releases
if ! echo "$JSON_RESPONSE" | jq empty 2>/dev/null; then
echo "Error: Invalid JSON response from GitHub API"
echo "Response: $JSON_RESPONSE"
exit 1
fi
# Check if response is an array
if [ "$(echo "$JSON_RESPONSE" | jq 'type')" != '"array"' ]; then
echo "Error: GitHub API response is not an array"
echo "Response type: $(echo "$JSON_RESPONSE" | jq 'type')"
echo "Response: $JSON_RESPONSE"
exit 1
fi
# Get the latest proton-ge-custom release tag
LATEST_TAG=$(echo "$JSON_RESPONSE" | jq -r '.[] | select(.tag_name | startswith("GE-Proton")) | .tag_name' | head -1)
if [ -z "$LATEST_TAG" ] || [ "$LATEST_TAG" = "null" ]; then
echo "Error: Could not find proton-ge-custom release"
echo "Available releases:"
echo "$JSON_RESPONSE" | jq -r '.[].tag_name' | head -10
exit 1
fi
# Remove 'GE-Proton' prefix to get version
LATEST_VERSION=${LATEST_TAG#GE-Proton}
echo "Latest tag: $LATEST_TAG"
echo "Latest version: $LATEST_VERSION"
# Check if version is different
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then
echo "New version available!"
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "latest_version=$LATEST_VERSION" >> $GITHUB_OUTPUT${{ steps.check_ge_proton_version.outputs.latest_tag }}
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
echo "update_needed=true" >> $GITHUB_OUTPUT
else
echo "No update needed"
echo "update_needed=false" >> $GITHUB_OUTPUT
fi
- name: Calculate new GE Proton hash
if: steps.check_ge_proton_version.outputs.update_needed == 'true'
id: calc_ge_proton_hash
run: |
URL="https://github.com/GloriousEggroll/proton-ge-custom/releases/download/${{ steps.check_ge_proton_version.outputs.latest_tag }}/GE-Proton${{ steps.check_ge_proton_version.outputs.latest_version }}.tar.gz"
echo "Calculating hash for: $URL"
HASH=$(nix-prefetch-url --unpack "$URL")
SRI_HASH=$(nix hash convert --to sri sha256:$HASH)
echo "Hash: $HASH"
echo "SRI Hash: $SRI_HASH"
echo "sri_hash=$SRI_HASH" >> $GITHUB_OUTPUT
- name: Update ge-proton.nix
if: steps.check_ge_proton_version.outputs.update_needed == 'true'
run: |
# Update version
sed -i 's/version = ".*";/version = "${{ steps.check_ge_proton_version.outputs.latest_version }}";/' ge-proton.nix
# Update hash (using SRI format) - use | as delimiter to avoid issues with / in hash
sed -i 's|hash = ".*";|hash = "${{ steps.calc_ge_proton_hash.outputs.sri_hash }}";|' ge-proton.nix
- name: Create GE Proton Pull Request
if: steps.check_ge_proton_version.outputs.update_needed == 'true'
id: create_ge_proton_pr
uses: peter-evans/create-pull-request@v7
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update ge-proton to ${{ steps.check_ge_proton_version.outputs.latest_version }}"
title: "Update ge-proton to ${{ steps.check_ge_proton_version.outputs.latest_version }}"
body: |
Automated update of ge-proton from ${{ steps.check_ge_proton_version.outputs.current_version }} to ${{ steps.check_ge_proton_version.outputs.latest_version }}.
- **Previous version**: ${{ steps.check_ge_proton_version.outputs.current_version }}
- **New version**: ${{ steps.check_ge_proton_version.outputs.latest_version }}
- **Release tag**: ${{ steps.check_ge_proton_version.outputs.latest_tag }}
- **Release URL**: https://github.com/GloriousEggroll/proton-ge-custom/releases/tag/${{ steps.check_ge_proton_version.outputs.latest_tag }}
This PR was automatically generated by the update workflow.
branch: update-ge-proton
delete-branch: true
- name: Check for new CachyOS Proton version
id: check_cachyos_proton_version
run: |
# Get current versions
CURRENT_VERSION=$(grep 'version = ' cachyos-proton.nix | sed 's/.*version = "\(.*\)";/\1/')
echo "Current version: $CURRENT_VERSION"
# Get latest release from GitHub API with error handling
echo "Fetching releases from GitHub API..."
RESPONSE=$(curl -s -w "\n%{http_code}" "https://api.github.com/repos/CachyOS/proton-cachyos/releases")
HTTP_CODE=$(echo "$RESPONSE" | tail -n 1)
JSON_RESPONSE=$(echo "$RESPONSE" | head -n -1)
echo "HTTP Status Code: $HTTP_CODE"
if [ "$HTTP_CODE" != "200" ]; then
echo "Error: GitHub API returned HTTP $HTTP_CODE"
echo "Response: $JSON_RESPONSE"
exit 1
fi
# Check if response is valid JSON and contains releases
if ! echo "$JSON_RESPONSE" | jq empty 2>/dev/null; then
echo "Error: Invalid JSON response from GitHub API"
echo "Response: $JSON_RESPONSE"
exit 1
fi
# Check if response is an array
if [ "$(echo "$JSON_RESPONSE" | jq 'type')" != '"array"' ]; then
echo "Error: GitHub API response is not an array"
echo "Response type: $(echo "$JSON_RESPONSE" | jq 'type')"
echo "Response: $JSON_RESPONSE"
exit 1
fi
# Get the latest proton-cachyos release tag
LATEST_TAG=$(echo "$JSON_RESPONSE" | jq -r '.[] | select(.tag_name | startswith("cachyos-")) | .tag_name' | head -1)
if [ -z "$LATEST_TAG" ] || [ "$LATEST_TAG" = "null" ]; then
echo "Error: Could not find proton-cachyos release"
echo "Available releases:"
echo "$JSON_RESPONSE" | jq -r '.[].tag_name' | head -10
exit 1
fi
# Remove 'cachyos-' prefix to get version
LATEST_VERSION=${LATEST_TAG#cachyos-}
echo "Latest tag: $LATEST_TAG"
echo "Latest version: $LATEST_VERSION"
# Check if version is different
if [ "$CURRENT_VERSION" != "$LATEST_VERSION" ]; then
echo "New version available!"
echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "latest_version=$LATEST_VERSION" >> $GITHUB_OUTPUT${{ steps.check_cachyos_proton_version.outputs.latest_tag }}
echo "latest_tag=$LATEST_TAG" >> $GITHUB_OUTPUT
echo "update_needed=true" >> $GITHUB_OUTPUT
else
echo "No update needed"
echo "update_needed=false" >> $GITHUB_OUTPUT
fi
- name: Calculate new CachyOS Proton hash
if: steps.check_cachyos_proton_version.outputs.update_needed == 'true'
id: calc_cachyos_proton_hash
run: |
URL="https://github.com/CachyOS/proton-cachyos/releases/download/${{ steps.check_cachyos_proton_version.outputs.latest_tag }}/proton-cachyos-${{ steps.check_cachyos_proton_version.outputs.latest_version }}-x86_64_v3.tar.xz"
echo "Calculating hash for: $URL"
HASH=$(nix-prefetch-url --unpack "$URL")
SRI_HASH=$(nix hash convert --to sri sha256:$HASH)
echo "Hash: $HASH"
echo "SRI Hash: $SRI_HASH"
echo "sri_hash=$SRI_HASH" >> $GITHUB_OUTPUT
- name: Update cachyos-proton.nix
if: steps.check_cachyos_proton_version.outputs.update_needed == 'true'
run: |
# Update version
sed -i 's/version = ".*";/version = "${{ steps.check_cachyos_proton_version.outputs.latest_version }}";/' cachyos-proton.nix
# Update hash (using SRI format) - use | as delimiter to avoid issues with / in hash
sed -i 's|hash = ".*";|hash = "${{ steps.calc_cachyos_proton_hash.outputs.sri_hash }}";|' cachyos-proton.nix
- name: Create CachyOS Proton Pull Request
if: steps.check_cachyos_proton_version.outputs.update_needed == 'true'
id: create_cachyos_proton_pr
uses: peter-evans/create-pull-request@v7
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Update cachyos-proton to ${{ steps.check_cachyos_proton_version.outputs.latest_version }}"
title: "Update cachyos-proton to ${{ steps.check_cachyos_proton_version.outputs.latest_version }}"
body: |
Automated update of cachyos-proton from ${{ steps.check_cachyos_proton_version.outputs.current_version }} to ${{ steps.check_cachyos_proton_version.outputs.latest_version }}.
- **Previous version**: ${{ steps.check_cachyos_proton_version.outputs.current_version }}
- **New version**: ${{ steps.check_cachyos_proton_version.outputs.latest_version }}
- **Release tag**: ${{ steps.check_cachyos_proton_version.outputs.latest_tag }}
- **Release URL**: https://github.com/CachyOS/proton-cachyos/releases/tag/${{ steps.check_cachyos_proton_version.outputs.latest_tag }}
This PR was automatically generated by the update workflow.
branch: update-cachyos-proton
delete-branch: true