-
Notifications
You must be signed in to change notification settings - Fork 10
260 lines (222 loc) · 8.72 KB
/
update-version.yml
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
name: "Update package version"
on:
schedule:
- cron: '0 */6 * * *'
workflow_dispatch:
jobs:
update:
name: Update
runs-on: ubuntu-latest
strategy:
matrix:
package:
- anime-game-launcher
- anime-games-launcher
- honkers-launcher
- honkers-railway-launcher
- wavey-launcher
- sleepy-launcher
steps:
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v3
- name: Pass all secrets to next steps
run: |
while read -rd $'' line; do echo "$line" >> $GITHUB_ENV; done < <( doppler secrets download --no-file --format=json | jq "." | grep -v 'DOPPLER_\(CONFIG\|ENVIRONMENT\|PROJECT\)' | jq -r 'to_entries|map("\(.key)<<EOF\n\(.value)\nEOF\u0000")[]' )
while read -r line; do echo "::add-mask::$line"; done < <( doppler secrets download --no-file --format=json | jq "." | grep -v 'DOPPLER_\(CONFIG\|ENVIRONMENT\|PROJECT\)' | jq -r 'to_entries|map("\(.value)\u0000")[]' )
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Checkout repository
uses: actions/checkout@v4
- name: Create commit message
id: commit-message
run: |
./pkgs/${{matrix.package}}/update.sh --commit-message >> "${{ matrix.package }}-commit.artifact"
- name: Update package
run: ./pkgs/${{matrix.package}}/update.sh
- name: Create diff
id: diff
run: |
set -x
git diff --oneline --graph > ${{ matrix.package }}-update.diff
if [[ "$(<${{ matrix.package }}-update.diff)" == "" ]]; then
echo "skipped=yes" >> $GITHUB_OUTPUT
echo "skipped=yes" > "${{ matrix.package }}-skipped.artifact"
else
echo "skipped=no" >> $GITHUB_OUTPUT
echo "skipped=no" > "${{ matrix.package }}-skipped.artifact"
fi
- name: Upload skip artifact
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.package }}-skipped.artifact"
path: "${{ matrix.package }}-skipped.artifact"
- name: Upload diff artifact
if: ${{ steps.diff.outputs.skipped == 'no' }}
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.package }}-update.diff"
path: "${{ matrix.package }}-update.diff"
- name: Upload commit artifact
uses: actions/upload-artifact@v4
with:
name: "${{ matrix.package }}-commit.artifact"
path: "${{ matrix.package }}-commit.artifact"
build:
name: Build
needs: update
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
cachixName:
- ezkea
nixpkgs:
- nixos-unstable
# - nixpkgs-unstable
- nixos-24.11
- pinned
package:
- anime-game-launcher
- anime-games-launcher
- honkers-railway-launcher
- honkers-launcher
- wavey-launcher
- sleepy-launcher
steps:
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v3
- name: Pass all secrets to next steps
run: |
while read -rd $'' line; do echo "$line" >> $GITHUB_ENV; done < <( doppler secrets download --no-file --format=json | jq "." | grep -v 'DOPPLER_\(CONFIG\|ENVIRONMENT\|PROJECT\)' | jq -r 'to_entries|map("\(.key)<<EOF\n\(.value)\nEOF\u0000")[]' )
while read -r line; do echo "::add-mask::$line"; done < <( doppler secrets download --no-file --format=json | jq "." | grep -v 'DOPPLER_\(CONFIG\|ENVIRONMENT\|PROJECT\)' | jq -r 'to_entries|map("\(.value)\u0000")[]' )
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Nix
uses: cachix/install-nix-action@v30
- name: Install Cachix
uses: cachix/cachix-action@v15
with:
name: ${{ matrix.cachixName }}
authToken: '${{ env.CACHIX_AUTH_TOKEN }}'
pushFilter: '(-source$|-src$|\.tar\.gz$|\.patch$)'
- name: Download diff artifact
uses: actions/download-artifact@v4
with:
name: "${{ matrix.package }}-update.diff"
path: "${{ matrix.package }}-update.diff"
- name: Check for update artifact
run: |
[[ -f "${{ matrix.package}}-update.diff/${{ matrix.package }}-update.diff" ]] || exit 1
- name: Apply diff
run: |
git apply "${{ matrix.package }}-update.diff/${{ matrix.package }}-update.diff"
- name: Build
id: build
run: |
if [[ ${{ matrix.nixpkgs }} == "pinned" ]]; then
nix build --accept-flake-config -L ".#${{ matrix.package }}"
else
nix build \
--accept-flake-config \
--print-build-logs \
--override-input nixpkgs "github:NixOS/nixpkgs/${{ matrix.nixpkgs }}" \
".#${{ matrix.package }}"
fi
env:
NIXPKGS_ALLOW_UNFREE: 1
- name: Create success artifact
if: steps.build.outcome == 'success'
run: |
echo "yes" >> "${{ matrix.package }}-${{ matrix.nixpkgs }}-success.artifact"
- name: Upload success artifact
uses: actions/upload-artifact@v4
if: steps.build.outcome == 'success'
with:
name: "${{ matrix.package }}-${{ matrix.nixpkgs }}-success.artifact"
path: "${{ matrix.package }}-${{ matrix.nixpkgs }}-success.artifact"
pr:
name: Make PR
if: ${{ ! cancelled() }}
needs: [update, build]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
package:
- anime-game-launcher
- anime-games-launcher
- honkers-railway-launcher
- honkers-launcher
- wavey-launcher
- sleepy-launcher
steps:
- name: Install Doppler CLI
uses: dopplerhq/cli-action@v3
- name: Pass all secrets to next steps
run: |
while read -rd $'' line; do echo "$line" >> $GITHUB_ENV; done < <( doppler secrets download --no-file --format=json | jq "." | grep -v 'DOPPLER_\(CONFIG\|ENVIRONMENT\|PROJECT\)' | jq -r 'to_entries|map("\(.key)<<EOF\n\(.value)\nEOF\u0000")[]' )
while read -r line; do echo "::add-mask::$line"; done < <( doppler secrets download --no-file --format=json | jq "." | grep -v 'DOPPLER_\(CONFIG\|ENVIRONMENT\|PROJECT\)' | jq -r 'to_entries|map("\(.value)\u0000")[]' )
env:
DOPPLER_TOKEN: ${{ secrets.DOPPLER_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: "${{ matrix.package }}-nixos-unstable-success.artifact"
path: "${{ matrix.package }}-nixos-unstable-success.artifact"
# - uses: actions/download-artifact@v4
# with:
# name: "${{ matrix.package }}-nixpkgs-unstable-success.artifact"
# path: "${{ matrix.package }}-nixpkgs-unstable-success.artifact"
- uses: actions/download-artifact@v4
with:
name: "${{ matrix.package }}-nixos-24.11-success.artifact"
path: "${{ matrix.package }}-nixos-24.11-success.artifact"
- uses: actions/download-artifact@v4
with:
name: "${{ matrix.package }}-pinned-success.artifact"
path: "${{ matrix.package }}-pinned-success.artifact"
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Download diff artifact
uses: actions/download-artifact@v4
with:
name: "${{ matrix.package }}-update.diff"
path: "${{ matrix.package }}-update.diff"
- name: Apply diff
run: |
git apply "${{ matrix.package }}-update.diff/${{ matrix.package }}-update.diff"
- name: Download commit artifact
uses: actions/download-artifact@v4
with:
name: "${{ matrix.package }}-commit.artifact"
path: "${{ matrix.package }}-commit.artifact"
- run: |
echo "commit-message=$(cat ${{ matrix.package }}-commit.artifact/${{ matrix.package }}-commit.artifact)" >> $GITHUB_ENV
- name: Create pull request
uses: peter-evans/create-pull-request@v7
with:
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
commit-message: ${{ env.commit-message }}
title: ${{ env.commit-message }}
body: |
Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
branch: "update-${{ matrix.package }}"
- name: Get workflow conclusion
uses: technote-space/workflow-conclusion-action@v3.0
- name: Send notification
uses: yanzay/notify-telegram@v0.1.0
with:
chat: ${{ env.NOTIFICATION_CHAT_ID }}
token: ${{ env.NOTIFICATION_TOKEN }}
status: ${{ env.WORKFLOW_CONCLUSION }}
if: needs.update.outputs.commit-message != ''