-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (81 loc) · 2.79 KB
/
build.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
name: build rootfs
on:
push:
branches:
- "main"
paths:
- ".github/workflows/**"
- "linux_files/**"
- "scripts/**"
- "Makefile"
workflow_dispatch:
schedule:
- cron: "0 10 */7 * *"
jobs:
build-rootfs:
runs-on: self-hosted
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Generate rootfs
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends -y make
make
sha256sum cachyos-v3-rootfs.wsl >cachyos-v3-rootfs.wsl.sha256
sha256sum cachyos-v4-rootfs.wsl >cachyos-v4-rootfs.wsl.sha256
sha256sum cachyos-znver4-rootfs.wsl >cachyos-znver4-rootfs.wsl.sha256
TAG_NAME=$(date +%Y%m%d)
jq -n '{ "ModernDistributions": { "CachyOS": [] } }' >DistributionInfo.json
cat *.sha256 | while read -r line; do
sha256=$(echo "$line" | awk '{print $1}')
filename=$(echo "$line" | awk '{print $2}')
if [[ "$filename" == *"v3"* ]]; then
Name="CachyOS"
FriendlyName="CachyOS (x86-64-v3)"
Default="true"
elif [[ "$filename" == *"v4"* ]]; then
Name="CachyOS_v4"
FriendlyName="CachyOS (x86-64-v4)"
Default="false"
elif [[ "$filename" == *"znver4"* ]]; then
Name="CachyOS_Zen4"
FriendlyName="CachyOS (Zen4)"
Default="false"
fi
jq --arg Name "$Name" \
--arg FriendlyName "$FriendlyName" \
--argjson Default "$Default" \
--arg Url "https://github.com/okrc/CachyOS-WSL/releases/download/$TAG_NAME/$filename" \
--arg Sha256 "$sha256" \
'.ModernDistributions.CachyOS += [{
"Name": $Name,
"FriendlyName": $FriendlyName,
"Default": $Default,
"Amd64Url": {
"Url": $Url,
"Sha256": $Sha256
}
}]' DistributionInfo.json >tmp.json && mv tmp.json DistributionInfo.json
done
tee /tmp/bodyfile.txt <<-EOF
### sha256sum
\`\`\`
$(cat *.sha256)
\`\`\`
EOF
echo "TAG_NAME=$TAG_NAME" >>$GITHUB_ENV
- name: Upload files to GitHub release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: |
cachyos-v3-rootfs.wsl
cachyos-v4-rootfs.wsl
cachyos-znver4-rootfs.wsl
DistributionInfo.json
bodyFile: /tmp/bodyfile.txt
tag: ${{ env.TAG_NAME }}